[GIS] Configuring geonode proxied by nginx on webfaction

geonodegeoserver

I'm trying to install geonode on webfaction.
Webfaction doesn't provide root access, so it needs installation from source.
I'm struggling to get authentication working.

Webfaction works like this (simplified a bit):

  • using their control panel, create an "application". This reserves a port.
  • also via control panel, create a "website". This maps a domain to this port. This happens via a system nginx instance which proxies all requests to the assigned port.

I created an nginx instance listening on this port, proxying to geonode (i.e. django, served using uwsgi) and geoserver (i.e. a tomcat webapp).

So the total setup is:

webfaction nginx -> my nginx -> / (django)
                             -> /geoserver/ (tomcat)

When loading the geonode homepage, tomcat logs as follows:

2014-05-08 05:49:06,865 WARN [geonode.security] - Error connecting to the GeoNode server for authentication purposes
org.springframework.security.authentication.AuthenticationServiceException: Communication with GeoNode failed
        at org.geonode.security.GeoNodeAuthenticationProvider.authenticate(GeoNodeAuthenticationProvider.java:61)
[...]
Caused by: java.io.IOException: GeoNode communication failed, status report is: 404, Not Found
        at org.geonode.security.HTTPClient.sendGET(HTTPClient.java:73)

Here is my nginx config:

pid /home/.../geonode2_nginx/parts/nginx-geonode/nginx-geonode.pid;
lock_file /home/.../geonode2_nginx/parts/nginx-geonode/nginx-geonode.lock;
daemon off;
events {
    worker_connections 1024;
}
http {
    server {
        listen 9999;
        access_log /home/.../logs/user/access_geonode2_nginx.log;
        error_log /home/.../logs/user/error_geonode2_nginx.log;
        # serve staticfiles
        location /static/ {
            include       /home/.../geonode2_nginx/parts/nginx/conf/mime.types;
            alias /home/.../geonode2_static/;
            expires 7d;
        }
        # serve mediafiles, default 'uploaded' in GeoNode
        location /uploaded/ {
            alias /home/.../geonode2_upload/;
            expires 7d;
        }
        # geoserver proxy
        location /geoserver/ {
            proxy_pass http://127.0.0.1:8888/geoserver/;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
        }
        # gunicorn/uwsgi wsgi proxy
        location / {
            proxy_pass_header Server;
            proxy_set_header Host $http_host;
            proxy_redirect off;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Scheme $scheme;
            proxy_connect_timeout 20;
            proxy_read_timeout 20;
            proxy_pass http://127.0.0.1:7777/;
        }
    }
}

Can anyone see anything wrong?

Any tips on debugging this? What HTTP headers should I look for?

How can I find out what the 404 in the tomcat message above refers to?

I asked this question on the webfaction forums also at
https://community.webfaction.com/questions/16732/geonode-configuration

Best Answer

The direct cause of the issue that I was experiencing was a configuration issue, addressed in this documentation patch:

https://github.com/GeoNode/geonode/commit/cc732e0a73c6d04d8f57fdf376dfb9a9848abd86

Related Question