Nginx lance un délai d’expiration de la passerelle 504 alors que uwsgi a répondu avec 200

J’exécute une application Django avec uWSGI et nginx. Tout fonctionne bien avec le serveur de développement django. Lorsque je le déplace vers uWSGI, j’observe un comportement étrange (est-ce?!). La demande est traitée correctement et uWSGI répond avec le code d’état 200. Le navigateur ne fait qu’attendre et finit par expirer.

Voici les logs uWSGI:

*** uWSGI is running in multiple interpreter mode *** spawned uWSGI master process (pid: 10342) spawned uWSGI worker 1 (pid: 10345, cores: 1) [pid: 10345|app: 0|req: 1/1] xx.xx.xx.xx () {48 vars in 870 bytes} [Mon Jul 4 19:33:07 2016] GET /kyc/dashboard/ => generated 28501 bytes in 7461 msecs (HTTP/1.1 200) 2 headers in 88 bytes (1 switches on core 0) 

Nginx error.log

 2016/07/04 19:38:14 [error] 10379#0: *1 upstream timed out (110: Connection timed out) while reading upstream, client: xx.xx.xx.xx, server: _, request: "GET /kyc/dashboard/ HTTP/1.1", upstream: "uwsgi://unix:///home/ubuntu/myapp.sock:", host: "xx.xx.xx.xx", referrer: "http://xx.xx.xx.xx/kyc/login/" 

uwsgi config

 [uwsgi] chdir=/home/ubuntu/myapp uid=ubuntu gid=ubuntu module=myapp.wsgi:application master=True workers=1 pidfile=/tmp/myapp-master.pid vacuum=True logger= file:/var/log/uwsgi/myapp.log logger = socket:xx.xx.xx.xx:5959 socket=/home/ubuntu/myapp.sock chmod-socket=777 die-on-term=True 

nginx conf

 user www-data; worker_processes 4; pid /run/nginx.pid; events { worker_connections 768; # multi_accept on; } http { include /etc/nginx/mime.types; default_type application/octet-stream; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; gzip on; gzip_disable "msie6"; upstream myapp { server unix:///home/ubuntu/myapp.sock; } server { listen 80; server_name _; location /static { alias /home/ubuntu/myapp/static_files; } location /media { alias /home/ubuntu/myapp/media_files; } location / { uwsgi_pass myapp; uwsgi_read_timeout 300; include /etc/nginx/uwsgi_params; # the uwsgi_params file you installed } } }