Why does my uwsgi app respond with prematurely closed connection?
I can serve my django app running uwsgi --socket lhhs/lhhs.sock --module lhhs/lhhs.wsgi --chmod-socket=664
And the django app runs quick and running python manage.py test shows it is fine.
But uisng nginx and uwsgi-emperor I get
upstream prematurely closed connection while reading response header from upstream, client: 74.45.12.120, server: lhhs.oh-joy.org, request: "GET / HTTP/1.1", upstream: "uwsgi://unix:///var/www/webapps/lhhs/lhhs/lhhs.sock:", host: "lhhs.oh-joy.org"
Here is my .ini file:
uid = www-data
chdir=/var/www/webapps/lhhs/lhhs
home=/var/www/webapps/lhhs/env
home=/var/www/webapps/lhhs/env
module=lhhs.wsgi:application
master=True
pidfile=/tmp/project-master.pid
vacuum=True
max-requests=5000
daemonize=/var/www/webapps/lhhs/log/lhhs-uwsgi.log
socket=/var/www/webapps/lhhs/lhhs/lhhs.sock
chmod-socket = 664
Here is my nginx config:
upstream django {
server unix:///var/www/webapps/lhhs/lhhs/lhhs.sock; # for a file socket
#server 127.0.0.1:8001; # for a web port socket (we'll use this first)
}
server {
listen 443 ssl;
server_name lhhs.oh-joy.org;
charset utf-8;
ssl_certificate /etc/letsencrypt/live/lhhs.oh-joy.org/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/lhhs.oh-joy.org/privkey.pem; # managed by Certbot
location /static {
alias /var/www/webapps/lhhs/lhhs/static;
}
location /media {
alias /var/www/webapps/lhhs/lhhs/media;
}
location /favicon.ico {
alias /var/www/webapps/lhhs/lhhs/static/images/favicon.ico;
}
location / {
include /etc/nginx/uwsgi_params;
uwsgi_pass django;
}
}
server {
if ($host = lhhs.oh-joy.org) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name lhhs.oh-joy.org;
return 404; # managed by Certbot
}