502 Bad Gateway error Nginx and uWSGI in deploying Flask app -


i'm trying deploy flask app on linode vps running ubuntu 10.10. i've been following tutorial (https://library.linode.com/web-servers/nginx/python-uwsgi/ubuntu-10.10-maverick#sph_configure-nginx) keep getting 502 bad gateway error.

here /etc/default/uwsgi:

pythonpath=/var/www/reframeit-im module=wsgi 

here /var/www/reframeit-im/wsgi.py:

# add application directory python path import sys sys.path.append("/var/www/reframeit-im")  # run flask app reframeit import app application 

here app's nginx config file, symlinked /sites-enabled directory (/opt/nginx/conf/sites-enabled/reframeit-im):

server {     listen 80;     server_name www.reframeit-im.coshx.com reframeit-im.coshx.com;     access_log /var/www/reframeit-im/logs/access.log;     error_log /var/www/reframeit-im/logs/error.log;      location / {         include uwsgi_params;         uwsgi_pass 127.0.0.1:9001;     } } 

i checked nginx error logs app , found this:

2013/07/17 19:30:19 [error] 20037#0: *1 upstream prematurely closed connection while reading response header upstream, client: 70.88.168.82, server: www.reframeit-im.coshx.com, request: "get /favicon.ico http/1.1", upstream: "uwsgi://127.0.0.1:9001", host: "reframeit-im.coshx.com" 

is there wrong configuration?

with uwsgi_pass 127.0.0.1:9001; declared nginx intent talk uwsgi through tcp socket, have not warned uwsgi it.

try adding corresponding socket line /etc/default/uwsgi file:

pythonpath=/var/www/reframeit-im module=wsgi socket=127.0.0.1:9001 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -