Help with deploying on nginx

503 views
Skip to first unread message

Apple Mason

unread,
Aug 29, 2013, 2:18:02 PM8/29/13
to web...@googlegroups.com
I keep getting 502 Bad Gateway, and I'm not sure why. I followed the Nginx deployment recipe on the website, with the following changes:

/etc/uwsgi/web2py.xml: Used /var/www-data/web2py/ instead of /home/www-data/web2py/

nginx conf: server_name is my server ip (I don't have a domain name) instead of $hostname. I also changed the location to /web2py instead of root.

Here is my nginx conf:

server {
        listen
443 default_server ssl;
        server_name     xxx
.xxx.xxx.xxx;
        ssl_certificate        
/etc/nginx/ssl/server.crt;
        ssl_certificate_key    
/etc/nginx/ssl/server.key;
        ssl_prefer_server_ciphers on
;
        ssl_session_cache shared
:SSL:10m;
        ssl_session_timeout
10m;
        ssl_ciphers ECDHE
-RSA-AES256-SHA:DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA;
        ssl_protocols
SSLv3 TLSv1;
        keepalive_timeout    
70;
        location
/web2py {
           
#uwsgi_pass      127.0.0.1:9001;
            uwsgi_pass      unix
:///tmp/web2py.socket;
            include         uwsgi_params
;
            uwsgi_param     UWSGI_SCHEME $scheme
;
            uwsgi_param     SERVER_SOFTWARE    nginx
/$nginx_version;
       
}
}



I omitted http since I only want to test over https for now.

Restarted both uwsgi and nginx in that order. uwsgi seems to find web2py okay in their logs:

announcing my loyalty to the Emperor...
*** vassal web2py.xml is now loyal ***


When I access "https://<server ip>/web2py", I get the 502 error.

Nginx error.log says:

2013/08/29 18:10:08 [error] 9793#0: *4 upstream prematurely closed connection while reading response header from upstream, client: xxx.xxx.xxx.xxx, server: xxx.xxx.xxx.xxx, request: "GET /web2py HTTP/1.1", upstream: "uwsgi://unix:///tmp/web2py.socket:", host: "xxx.xxx.xxx.xxx.

I'm running ubuntu 13.04 server, if that's any use.


Niphlod

unread,
Aug 29, 2013, 3:10:20 PM8/29/13
to web...@googlegroups.com
what does uwsgi log show ?

Apple Mason

unread,
Aug 29, 2013, 3:18:45 PM8/29/13
to web...@googlegroups.com
There's a lot of lines but here's a good portion of it:



*** Operational MODE: no-workers ***
spawned uWSGI master process
(pid: 10483)
*** starting uWSGI Emperor ***
*** has_emperor mode detected (fd: 6) ***
[uWSGI] parsing config file web2py.xml
*** Starting uWSGI 1.2.3-debian (64bit) on [Thu Aug 29 18:25:59 2013] ***
compiled
with version: 4.7.2 on 07 November 2012 03:49:52
detected number of CPU cores
: 8
current working directory
: /etc/uwsgi
detected binary path
: /usr/bin/uwsgi-core
setgid
() to 33
setuid
() to 33
limiting address space of processes
...
your process address space limit
is 536870912 bytes (512 MB)
your memory page size
is 4096 bytes
 
*** WARNING: you have enabled harakiri without post buffering. Slow upload could be rejected on post-unbuffered webservers ***
detected max file descriptor number
: 1024
lock engine: pthread robust mutexes
uwsgi socket
0 bound to UNIX address /tmp/web2py.socket fd 3
your server socket listen backlog
is limited to 100 connections
*** Operational MODE: preforking ***
mounting wsgihandler
:application on /
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process
(pid: 10485)
spawned uWSGI worker
1 (pid: 10486, cores: 1)
set cpu affinity for worker 1 to 0
spawned uWSGI worker
2 (pid: 10487, cores: 1)
spawned uWSGI worker
1 (pid: 10486, cores: 1)
set cpu affinity for worker 1 to 0
spawned uWSGI worker
2 (pid: 10487, cores: 1)
set cpu affinity for worker 2 to 1spawned uWSGI worker 3 (pid: 10488, cores: 1)
set cpu affinity for worker 3 to 2
spawned uWSGI worker
4 (pid: 10489, cores: 1)
*** Stats server enabled on /tmp/stats.socket fd: 16 ***
set cpu affinity for worker 4 to 3
-- unavailable modifier requested: 0 --

announcing
my loyalty to the Emperor...
*** vassal web2py.xml is now loyal ***
-- unavailable modifier requested: 0 --

announcing
my loyalty to the Emperor...
*** vassal web2py.xml is now loyal ***
-- unavailable modifier requested: 0 --
-- unavailable modifier requested: 0 --

announcing
my loyalty to the Emperor...
*** vassal web2py.xml is now loyal ***
-- unavailable modifier requested: 0 --

announcing
my loyalty to the Emperor...
*** vassal web2py.xml is now loyal ***
-- unavailable modifier requested: 0 --
-- unavailable modifier requested: 0 --
-- unavailable modifier requested: 0 --
-- unavailable modifier requested: 0 --
-- unavailable modifier requested: 0 --
-- unavailable modifier requested: 0 --
-- unavailable modifier requested: 0 --
-- unavailable modifier requested: 0 --
-- unavailable modifier requested: 0 --
-- unavailable modifier requested: 0 --
-- unavailable modifier requested: 0 --
-- unavailable modifier requested: 0 --
-- unavailable modifier requested: 0 --
-- unavailable modifier requested: 0 --
-- unavailable modifier requested: 0 --
-- unavailable modifier requested: 0 --
-- unavailable modifier requested: 0 --
-- unavailable modifier requested: 0 --
-- unavailable modifier requested: 0 --

Niphlod

unread,
Aug 29, 2013, 8:38:27 PM8/29/13
to web...@googlegroups.com
http://stackoverflow.com/questions/10748108/nginx-uwsgi-unavailable-modifier-requested-0

its better to build uwsgi from source, so you dont' get caught in this crazy-organized apt packages.
Reply all
Reply to author
Forward
0 new messages