I get '*502 Bad Gateway' *errors with the following setup:

/etc/nginx/sites-available/web2py:
server {

    lister  80;
    server_name $hostname;
    location  ~* /(\w+)/static/ {
        root  /home/www-data/web2py/applications/;
    }
    location / {
        uwsgi_pass  127.0.0.1:9001;
        include     uwsgi_params;
    }
}

server {
    listen  443;
    server_name $hostname;
    ssl     on;
    ssl_certificate     /etc/nginx/ssl/web2py.crt;
    ssl_certificate_key /etc/nginx/ssl/web2py.key;
    location / {
        uwsgi_pass  127.0.0.1:9001;
        include     uwsgi_params;
        uwsgi_param UWSGI_SCHEME $SCHEME;
    }
}


and /etc/uwsgi/apps-available/web2py.xml (This file is also in 
/home/www-data/web2py.py as the instructions in the book is not clear on 
where it's location saying at first it should be put in the web2py root and 
later that it should be linked from /etc/uwsgi/apps-available  to 
/etc/uwsgi/apps-enabled)

<uwsgi>
    <socket>127.0.0.1:9001</socket>
    <pythonpath>/home/www-data/web2py/</pythonpath>
    <app mountpoint="/">
        <script>wsgihandler</script>
    </app>
</uwsgi>

In /var/log/nginx/error.log I found this:

2012/04/11 15:36:19 [error] 25277#0: *5 upstream prematurely closed 
connection while reading response header from upstream, client: 
146.232.82.145, server: artikel, request: "GET /favicon.ico HTTP/1.1", 
upstream: "uwsgi://127.0.0.1:9001", host: "artikel"


and in /var/log/uwsgi/apps/web2py.log:

Wed Apr 11 15:25:37 2012 - *** Operational MODE: preforking ***
Wed Apr 11 15:25:37 2012 - mounting wsgihandler on /
Wed Apr 11 15:25:37 2012 - *** no app loaded. going in full dynamic mode ***
Wed Apr 11 15:25:37 2012 - *** uWSGI is running in multiple interpreter 
mode ***
Wed Apr 11 15:25:37 2012 - spawned uWSGI master process (pid: 25174)
Wed Apr 11 15:25:37 2012 - spawned uWSGI worker 1 (pid: 25180, cores: 1)
Wed Apr 11 15:25:37 2012 - spawned uWSGI worker 2 (pid: 25181, cores: 1)
Wed Apr 11 15:25:48 2012 - -- unavailable modifier requested: 0 --
Wed Apr 11 15:32:30 2012 - read(): Socket operation on non-socket [proto/
uwsgi.c line 40]
Wed Apr 11 15:32:30 2012 - error parsing request


What am I doing wrong?  If I telnet to localhost port 9001 the 
uwsgi-process seems to listen.

Regards. 

Johann

Reply via email to