Nginx 502 mauvaise passerelle django in uwsgi

J'ai essayé de redémarrer un projet en production et il a cessé de fonctionner. Il s'agit d'un projet django == 1.5.1 et django-cms == 2.4.1. J'ai redémarré parce que j'ai mis à jour le projet de django == 1.4.1 vers django == 1.5.1, mais aussi longtime que je sais qu'il ne change rien à wsgi.ini.

Lorsque j'ai rechargé le projet, il a soulevé une erreur de 500. Ensuite, j'ai décidé de supprimer mon /tmp/zecaffe.sock pour le recréer, puis j'ai redémarré le projet, et maintenant, lorsque j'ai regardé dans mon error_zecaffe.log, il montre cette erreur:

2013/05/03 16:16:35 [crit] 32378#0: *207 connect() to unix:///tmp/zecaffe.sock failed (2: No such file or directory) while connecting to upstream, client: 189.75.17.67, server: zecaffe.infalms.com.br, request: "GET / HTTP/1.1", upstream: "uwsgi://unix:///tmp/zecaffe.sock:", host: "zecaffe.infalms.com.br" 2013/05/03 16:16:36 [crit] 32378#0: *207 connect() to unix:///tmp/zecaffe.sock failed (2: No such file or directory) while connecting to upstream, client: 189.75.17.67, server: zecaffe.infalms.com.br, request: "GET /favicon.ico HTTP/1.1", upstream: "uwsgi://unix:///tmp/zecaffe.sock:", host: "zecaffe.infalms.com.br" 

Il semble que l'empereur ne recréé pas un autre file .sock. Eh bien, c'est mon uwsgi.ini:

 [uwsgi] # caminho para o virtualenv no qual o projeto ira rodar home = /home/infalms/.virtualenvs/zecaffe # socket gerado no momento da inicializacao do uwsgi. Pode ser um servidor ou arquivo.sock. # o socket estabelece a ponte de comunicacao entre as requirejsicoes que chegam no nginx/apache # e as trasnfere para o projeto django especificado o projeto especificado no chdir # neste caso esta sendo usado socket em arquivo #socket = 127.0.0.1:8000 socket = /tmp/zecaffe.sock # define a que usuario o socket pertence. deve ser o mesmo usuario de execucao do # Nginx definido no arquivo de configuracao do nginx. /etc/nginx/nginx.conf uid = [user-name] gid = [user-name] chmod-socket = 777 chown-socket = [user-name] # Esta a pasta do projeto chdir = /home/infalms/webapps/zecaffe logto = /var/log/uwsgi/zecaffe.com.br.log # Carrega o arquivo de inicializacao do projeto, onde "meuprojeto" é a pasta e "wsgi" # eo nome do arquivo wsgi.py contido dentro da pasta "meuprojeto". module = zecaffe.wsgi 

C'est mon file journal uwsgi:

 *** has_emperor mode detected (fd: 11) *** [uWSGI] getting INI configuration from zecaffe.com.br.ini *** Starting uWSGI 1.4.4 (64bit) on [Fri May 3 15:54:02 2013] *** comstackd with version: 4.6.3 on 20 January 2013 20:27:33 os: Linux-3.7.10-x86_64-linode30 #1 SMP Wed Feb 27 14:29:31 EST 2013 nodename: infalms machine: x86_64 clock source: unix detected number of CPU cores: 8 current working directory: /etc/uwsgi/vassals/enabled detected binary path: /usr/local/bin/uwsgi your processes number limit is 3870 your memory page size is 4096 bytes detected max file descriptor number: 1024 lock engine: pthread robust mutexes uwsgi socket 0 inherited UNIX address /tmp/zecaffe.sock fd 3 Python version: 2.7.3 (default, Aug 1 2012, 05:25:23) [GCC 4.6.3] Set PythonHome to /home/infalms/.virtualenvs/zecaffe *** Python threads support is disabled. You can enable it with --enable-threads *** Python main interpreter initialized at 0xf05d20 your server socket listn backlog is limited to 100 connections mapped 144784 bytes (141 KB) for 1 cores *** Operational MODE: single process *** WSGI app 0 (mountpoint='') ready in 1 seconds on interpreter 0xf05d20 pid: 19117 (default app) *** uWSGI is running in multiple interpreter mode *** gracefully (RE)spawned uWSGI master process (pid: 19117) spawned uWSGI worker 1 (pid: 32430, cores: 1) Fri May 3 16:16:15 2013 - received message 1 from emperor ...gracefully killing workers... Gracefully killing worker 1 (pid: 32430)... binary reloading uWSGI... chdir() to /etc/uwsgi/vassals/enabled closing all non-uwsgi socket fds > 2 (max_fd = 1024)... found fd 3 mapped to socket 0 (/tmp/zecaffe.sock) running /usr/local/bin/uwsgi *** has_emperor mode detected (fd: 11) *** [uWSGI] getting INI configuration from zecaffe.com.br.ini *** Starting uWSGI 1.4.4 (64bit) on [Fri May 3 16:16:16 2013] *** comstackd with version: 4.6.3 on 20 January 2013 20:27:33 os: Linux-3.7.10-x86_64-linode30 #1 SMP Wed Feb 27 14:29:31 EST 2013 nodename: infalms machine: x86_64 clock source: unix detected number of CPU cores: 8 current working directory: /etc/uwsgi/vassals/enabled detected binary path: /usr/local/bin/uwsgi your processes number limit is 3870 your memory page size is 4096 bytes detected max file descriptor number: 1024 lock engine: pthread robust mutexes uwsgi socket 0 inherited UNIX address /tmp/zecaffe.sock fd 3 Python version: 2.7.3 (default, Aug 1 2012, 05:25:23) [GCC 4.6.3] Set PythonHome to /home/infalms/.virtualenvs/zecaffe *** Python threads support is disabled. You can enable it with --enable-threads *** Python main interpreter initialized at 0x6bbd20 your server socket listn backlog is limited to 100 connections mapped 144784 bytes (141 KB) for 1 cores *** Operational MODE: single process *** WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x6bbd20 pid: 19117 (default app) *** uWSGI is running in multiple interpreter mode *** gracefully (RE)spawned uWSGI master process (pid: 19117) spawned uWSGI worker 1 (pid: 357, cores: 1) 

C'est ma configuration nginx:

 upstream zecaffe { #server 127.0.0.1:8000; server unix:///tmp/zecaffe.sock; } server { listn 80; server_name zecaffe.infalms.com.br; # dominio do projeto. Se for local, seta como localhost #client_body_in_file_only clean; #client_body_buffer_size 32K; client_max_body_size 20M; #sendfile on; #send_timeout 0s; error_log /var/log/nginx/error_zecaffe; access_log /var/log/nginx/access_zecaffe; location /media { autoindex on; alias /home/infalms/webapps/zecaffe/zecaffe/media; # your Django project's media files } location /static { autoindex on; alias /home/infalms/webapps/zecaffe/zecaffe/static; # your Django project's static files } # Finally, send all non-media requests to the Django server. location / { uwsgi_pass zecaffe; include /etc/nginx/uwsgi_params; # or the uwsgi_params you installed manually } } 

Ce journal d'erreurs nginx (error_zecaffe):

 2013/05/01 13:02:30 [error] 19146#0: *16798 upstream prematurely closed connection while reading response header from upstream, client: 187.7.60.53, server: zecaffe.infalms.com.br, request: "GET /favicon.ico/ HTTP/1.1", upstream: "uwsgi://unix:///tmp/zecaffe.sock:", host: "zecaffe.infalms.com.br" 2013/05/01 13:02:36 [error] 19146#0: *16798 upstream prematurely closed connection while reading response header from upstream, client: 187.7.60.53, server: zecaffe.infalms.com.br, request: "GET /favicon.ico/ HTTP/1.1", upstream: "uwsgi://unix:///tmp/zecaffe.sock:", host: "zecaffe.infalms.com.br" 2013/05/01 13:02:39 [error] 19146#0: *16800 upstream prematurely closed connection while reading response header from upstream, client: 187.7.60.53, server: zecaffe.infalms.com.br, request: "GET /favicon.ico/ HTTP/1.1", upstream: "uwsgi://unix:///tmp/zecaffe.sock:", host: "zecaffe.infalms.com.br" 2013/05/01 13:02:42 [error] 19146#0: *16806 upstream prematurely closed connection while reading response header from upstream, client: 187.7.60.53, server: zecaffe.infalms.com.br, request: "GET /favicon.ico/ HTTP/1.1", upstream: "uwsgi://unix:///tmp/zecaffe.sock:", host: "zecaffe.infalms.com.br" 2013/05/01 13:02:50 [error] 19146#0: *16809 upstream prematurely closed connection while reading response header from upstream, client: 187.7.60.53, server: zecaffe.infalms.com.br, request: "GET /favicon.ico/ HTTP/1.1", upstream: "uwsgi://unix:///tmp/zecaffe.sock:", host: "zecaffe.infalms.com.br" 2013/05/01 13:03:29 [error] 19146#0: *16818 upstream prematurely closed connection while reading response header from upstream, client: 187.7.60.53, server: zecaffe.infalms.com.br, request: "GET /favicon.ico/ HTTP/1.1", upstream: "uwsgi://unix:///tmp/zecaffe.sock:", host: "zecaffe.infalms.com.br" 2013/05/01 13:03:35 [error] 19146#0: *16812 open() "/home/infalms/webapps/zecaffe/zecaffe/static/ckeditor/ckeditor/skins/moono/skin.js" failed (2: No such file or directory), client: 187.7.60.53, server: zecaffe.infalms.com.br, request: "GET /static/ckeditor/ckeditor/skins/moono/skin.js?t=B8DJ5M3 HTTP/1.1", host: "zecaffe.infalms.com.br", referrer: "http://zecaffe.infalms.com.br/admin/core/noticia/add/" 2013/05/01 13:03:35 [error] 19146#0: *16812 open() "/home/infalms/webapps/zecaffe/zecaffe/static/ckeditor/ckeditor/skins/moono/skin.js" failed (2: No such file or directory), client: 187.7.60.53, server: zecaffe.infalms.com.br, request: "GET /static/ckeditor/ckeditor/skins/moono/skin.js?t=B8DJ5M3 HTTP/1.1", host: "zecaffe.infalms.com.br", referrer: "http://zecaffe.infalms.com.br/admin/core/noticia/add/" 2013/05/01 13:03:35 [error] 19146#0: *16819 upstream prematurely closed connection while reading response header from upstream, client: 187.7.60.53, server: zecaffe.infalms.com.br, request: "GET /favicon.ico/ HTTP/1.1", upstream: "uwsgi://unix:///tmp/zecaffe.sock:", host: "zecaffe.infalms.com.br" 2013/05/01 13:04:23 [error] 19146#0: *16812 open() "/home/infalms/webapps/zecaffe/zecaffe/static/ckeditor/ckeditor/skins/moono/skin.js" failed (2: No such file or directory), client: 187.7.60.53, server: zecaffe.infalms.com.br, request: "GET /static/ckeditor/ckeditor/skins/moono/skin.js?t=B8DJ5M3 HTTP/1.1", host: "zecaffe.infalms.com.br", referrer: "http://zecaffe.infalms.com.br/admin/core/noticia/add/" 2013/05/01 13:04:24 [error] 19146#0: *16812 open() "/home/infalms/webapps/zecaffe/zecaffe/static/ckeditor/ckeditor/skins/moono/skin.js" failed (2: No such file or directory), client: 187.7.60.53, server: zecaffe.infalms.com.br, request: "GET /static/ckeditor/ckeditor/skins/moono/skin.js?t=B8DJ5M3 HTTP/1.1", host: "zecaffe.infalms.com.br", referrer: "http://zecaffe.infalms.com.br/admin/core/noticia/add/" 2013/05/01 13:04:24 [error] 19146#0: *16812 upstream prematurely closed connection while reading response header from upstream, client: 187.7.60.53, server: zecaffe.infalms.com.br, request: "GET /favicon.ico/ HTTP/1.1", upstream: "uwsgi://unix:///tmp/zecaffe.sock:", host: "zecaffe.infalms.com.br" 2013/05/01 13:04:26 [error] 19146#0: *16812 upstream prematurely closed connection while reading response header from upstream, client: 187.7.60.53, server: zecaffe.infalms.com.br, request: "GET /favicon.ico/ HTTP/1.1", upstream: "uwsgi://unix:///tmp/zecaffe.sock:", host: "zecaffe.infalms.com.br" 2013/05/01 13:13:11 [error] 19144#0: *16928 upstream prematurely closed connection while reading response header from upstream, client: 187.7.60.53, server: zecaffe.infalms.com.br, request: "GET /favicon.ico/ HTTP/1.1", upstream: "uwsgi://unix:///tmp/zecaffe.sock:", host: "zecaffe.infalms.com.br" 2013/05/01 13:16:20 [error] 19147#0: *16965 upstream prematurely closed connection while reading response header from upstream, client: 187.7.60.53, server: zecaffe.infalms.com.br, request: "GET /favicon.ico/ HTTP/1.1", upstream: "uwsgi://unix:///tmp/zecaffe.sock:", host: "zecaffe.infalms.com.br" 2013/05/01 13:19:16 [error] 19147#0: *16976 upstream prematurely closed connection while reading response header from upstream, client: 187.7.60.53, server: zecaffe.infalms.com.br, request: "GET /favicon.ico/ HTTP/1.1", upstream: "uwsgi://unix:///tmp/zecaffe.sock:", host: "zecaffe.infalms.com.br" 2013/05/03 15:16:18 [crit] 19146#0: *32344 connect() to unix:///tmp/zecaffe.sock failed (2: No such file or directory) while connecting to upstream, client: 189.75.17.67, server: zecaffe.infalms.com.br, request: "GET /admin/ HTTP/1.1", upstream: "uwsgi://unix:///tmp/zecaffe.sock:", host: "zecaffe.infalms.com.br" 2013/05/03 15:16:19 [crit] 19146#0: *32344 connect() to unix:///tmp/zecaffe.sock failed (2: No such file or directory) while connecting to upstream, client: 189.75.17.67, server: zecaffe.infalms.com.br, request: "GET /favicon.ico HTTP/1.1", upstream: "uwsgi://unix:///tmp/zecaffe.sock:", host: "zecaffe.infalms.com.br" 2013/05/03 15:16:49 [crit] 30969#0: *3 connect() to unix:///tmp/zecaffe.sock failed (2: No such file or directory) while connecting to upstream, client: 189.75.17.67, server: zecaffe.infalms.com.br, request: "GET /admin/ HTTP/1.1", upstream: "uwsgi://unix:///tmp/zecaffe.sock:", host: "zecaffe.infalms.com.br" 2013/05/03 15:16:49 [crit] 30969#0: *3 connect() to unix:///tmp/zecaffe.sock failed (2: No such file or directory) while connecting to upstream, client: 189.75.17.67, server: zecaffe.infalms.com.br, request: "GET /favicon.ico HTTP/1.1", upstream: "uwsgi://unix:///tmp/zecaffe.sock:", host: "zecaffe.infalms.com.br" 2013/05/03 15:17:07 [crit] 30969#0: *3 connect() to unix:///tmp/zecaffe.sock failed (2: No such file or directory) while connecting to upstream, client: 189.75.17.67, server: zecaffe.infalms.com.br, request: "GET /admin/ HTTP/1.1", upstream: "uwsgi://unix:///tmp/zecaffe.sock:", host: "zecaffe.infalms.com.br" 2013/05/03 15:17:07 [crit] 30969#0: *3 connect() to unix:///tmp/zecaffe.sock failed (2: No such file or directory) while connecting to upstream, client: 189.75.17.67, server: zecaffe.infalms.com.br, request: "GET /favicon.ico HTTP/1.1", upstream: "uwsgi://unix:///tmp/zecaffe.sock:", host: "zecaffe.infalms.com.br" 2013/05/03 15:20:11 [crit] 30969#0: *21 connect() to unix:///tmp/zecaffe.sock failed (2: No such file or directory) while connecting to upstream, client: 189.75.17.67, server: zecaffe.infalms.com.br, request: "GET /admin/ HTTP/1.1", upstream: "uwsgi://unix:///tmp/zecaffe.sock:", host: "zecaffe.infalms.com.br" 2013/05/03 15:20:11 [crit] 30969#0: *21 connect() to unix:///tmp/zecaffe.sock failed (2: No such file or directory) while connecting to upstream, client: 189.75.17.67, server: zecaffe.infalms.com.br, request: "GET /favicon.ico HTTP/1.1", upstream: "uwsgi://unix:///tmp/zecaffe.sock:", host: "zecaffe.infalms.com.br" 2013/05/03 15:20:12 [crit] 30969#0: *21 connect() to unix:///tmp/zecaffe.sock failed (2: No such file or directory) while connecting to upstream, client: 189.75.17.67, server: zecaffe.infalms.com.br, request: "GET /admin/ HTTP/1.1", upstream: "uwsgi://unix:///tmp/zecaffe.sock:", host: "zecaffe.infalms.com.br" 2013/05/03 15:20:13 [crit] 30969#0: *21 connect() to unix:///tmp/zecaffe.sock failed (2: No such file or directory) while connecting to upstream, client: 189.75.17.67, server: zecaffe.infalms.com.br, request: "GET /favicon.ico HTTP/1.1", upstream: "uwsgi://unix:///tmp/zecaffe.sock:", host: "zecaffe.infalms.com.br" 2013/05/03 15:20:51 [crit] 30969#0: *21 connect() to unix:///tmp/zecaffe.sock failed (2: No such file or directory) while connecting to upstream, client: 189.75.17.67, server: zecaffe.infalms.com.br, request: "GET /admin/ HTTP/1.1", upstream: "uwsgi://unix:///tmp/zecaffe.sock:", host: "zecaffe.infalms.com.br" 2013/05/03 15:20:52 [crit] 30969#0: *21 connect() to unix:///tmp/zecaffe.sock failed (2: No such file or directory) while connecting to upstream, client: 189.75.17.67, server: zecaffe.infalms.com.br, request: "GET /favicon.ico HTTP/1.1", upstream: "uwsgi://unix:///tmp/zecaffe.sock:", host: "zecaffe.infalms.com.br" 2013/05/03 15:20:56 [crit] 30969#0: *21 connect() to unix:///tmp/zecaffe.sock failed (2: No such file or directory) while connecting to upstream, client: 189.75.17.67, server: zecaffe.infalms.com.br, request: "GET / HTTP/1.1", upstream: "uwsgi://unix:///tmp/zecaffe.sock:", host: "zecaffe.infalms.com.br" 2013/05/03 15:20:56 [crit] 30969#0: *21 connect() to unix:///tmp/zecaffe.sock failed (2: No such file or directory) while connecting to upstream, client: 189.75.17.67, server: zecaffe.infalms.com.br, request: "GET /favicon.ico HTTP/1.1", upstream: "uwsgi://unix:///tmp/zecaffe.sock:", host: "zecaffe.infalms.com.br" 2013/05/03 15:28:21 [crit] 30969#0: *73 connect() to unix:///tmp/zecaffe.sock failed (2: No such file or directory) while connecting to upstream, client: 189.75.17.67, server: zecaffe.infalms.com.br, request: "GET / HTTP/1.1", upstream: "uwsgi://unix:///tmp/zecaffe.sock:", host: "zecaffe.infalms.com.br" 2013/05/03 15:28:21 [crit] 30969#0: *73 connect() to unix:///tmp/zecaffe.sock failed (2: No such file or directory) while connecting to upstream, client: 189.75.17.67, server: zecaffe.infalms.com.br, request: "GET /favicon.ico HTTP/1.1", upstream: "uwsgi://unix:///tmp/zecaffe.sock:", host: "zecaffe.infalms.com.br" 2013/05/03 15:38:29 [crit] 30972#0: *107 connect() to unix:///tmp/zecaffe.sock failed (2: No such file or directory) while connecting to upstream, client: 189.75.17.67, server: zecaffe.infalms.com.br, request: "GET / HTTP/1.1", upstream: "uwsgi://unix:///tmp/zecaffe.sock:", host: "zecaffe.infalms.com.br" 2013/05/03 15:38:29 [crit] 30972#0: *107 connect() to unix:///tmp/zecaffe.sock failed (2: No such file or directory) while connecting to upstream, client: 189.75.17.67, server: zecaffe.infalms.com.br, request: "GET /favicon.ico HTTP/1.1", upstream: "uwsgi://unix:///tmp/zecaffe.sock:", host: "zecaffe.infalms.com.br" 2013/05/03 15:54:28 [crit] 32378#0: *57 connect() to unix:///tmp/zecaffe.sock failed (13: Permission denied) while connecting to upstream, client: 189.75.17.67, server: zecaffe.infalms.com.br, request: "GET / HTTP/1.1", upstream: "uwsgi://unix:///tmp/zecaffe.sock:", host: "zecaffe.infalms.com.br" 2013/05/03 15:54:29 [crit] 32378#0: *57 connect() to unix:///tmp/zecaffe.sock failed (13: Permission denied) while connecting to upstream, client: 189.75.17.67, server: zecaffe.infalms.com.br, request: "GET /favicon.ico HTTP/1.1", upstream: "uwsgi://unix:///tmp/zecaffe.sock:", host: "zecaffe.infalms.com.br" 2013/05/03 16:13:16 [crit] 32378#0: *175 connect() to unix:///tmp/zecaffe.sock failed (13: Permission denied) while connecting to upstream, client: 189.75.17.67, server: zecaffe.infalms.com.br, request: "GET / HTTP/1.1", upstream: "uwsgi://unix:///tmp/zecaffe.sock:", host: "zecaffe.infalms.com.br" 2013/05/03 16:13:17 [crit] 32378#0: *175 connect() to unix:///tmp/zecaffe.sock failed (13: Permission denied) while connecting to upstream, client: 189.75.17.67, server: zecaffe.infalms.com.br, request: "GET /favicon.ico HTTP/1.1", upstream: "uwsgi://unix:///tmp/zecaffe.sock:", host: "zecaffe.infalms.com.br" 2013/05/03 16:16:23 [crit] 32378#0: *207 connect() to unix:///tmp/zecaffe.sock failed (2: No such file or directory) while connecting to upstream, client: 189.75.17.67, server: zecaffe.infalms.com.br, request: "GET / HTTP/1.1", upstream: "uwsgi://unix:///tmp/zecaffe.sock:", host: "zecaffe.infalms.com.br" 2013/05/03 16:16:23 [crit] 32378#0: *207 connect() to unix:///tmp/zecaffe.sock failed (2: No such file or directory) while connecting to upstream, client: 189.75.17.67, server: zecaffe.infalms.com.br, request: "GET /favicon.ico HTTP/1.1", upstream: "uwsgi://unix:///tmp/zecaffe.sock:", host: "zecaffe.infalms.com.br" 2013/05/03 16:16:35 [crit] 32378#0: *207 connect() to unix:///tmp/zecaffe.sock failed (2: No such file or directory) while connecting to upstream, client: 189.75.17.67, server: zecaffe.infalms.com.br, request: "GET / HTTP/1.1", upstream: "uwsgi://unix:///tmp/zecaffe.sock:", host: "zecaffe.infalms.com.br" 2013/05/03 16:16:36 [crit] 32378#0: *207 connect() to unix:///tmp/zecaffe.sock failed (2: No such file or directory) while connecting to upstream, client: 189.75.17.67, server: zecaffe.infalms.com.br, request: "GET /favicon.ico HTTP/1.1", upstream: "uwsgi://unix:///tmp/zecaffe.sock:", host: "zecaffe.infalms.com.br" 

Maintenant, je reçois une erreur 502 (mauvaise passerelle) 🙁

2 Solutions collect form web for “Nginx 502 mauvaise passerelle django in uwsgi”

Vous devez vérifier les permissions pour créer .sock-file dans /tmp/ dir. Je recommand de créer un directory différent pour les files .pid et .sock:

 cd /var/run/ makedir django chown www-data:www-data django 

Ensuite, modifiez vos parameters sur:

 socket=/var/run/zecaffe.sock 

Ou utilisez le gunicorn (recommandé):

 workon zecaffe pip install gunicorn 

Créez le file gucicorn.conf.py pour exécuter l'application dans /var/www/zecaffe/conf directory:

 #! coding: utf-8 import os import multiprocessing os.environ['DJANGO_SETTINGS_MODULE'] = 'zecaffe.settings' short_name = "zecaffe" bind = "unix:/var/run/django/%s.sock" % short_name proc_name = "/var/run/django/%s" % short_name workers = multiprocessing.cpu_count() * 2 + 1 user = "www-data" group = "www-data" loglevel = "warn" timeout = 600 keepalive = 5 

Installez le superviseur et ajoutez ceci à /etc/supervisor/conf.d/zecaffe.conf:

 [program:zecaffe] directory = /var/www/zecaffe user="www-data" group="www-data" environment=DJANGO_SETTINGS_MODULE="zecaffe.settings",PYTHONIOENCODING="UTF-8",LANG="en_US.UTF-8",LC_ALL="en_US.UTF-8",LC_LANG="en_US.UTF-8" command=/var/www/.virtualenvs/zencafe/bin/gunicorn_django -c /var/www/zecaffe/conf/gunicorn.conf.py stderr_logfile = /var/www/zecaffe/log/supervisor_error.log 

N'oubliez pas le mode de changement pour gunicorn.conf.py :

 chmod u+x /var/www/zecaffe/conf/gunicorn.conf.py 

Exécutez la supervisorctl update et profitez-en!

J'ai eu la même erreur.

Un paramètre nécessaire manquant dans settings.py:

 # Hosts/domain names that are valid for this site; required if DEBUG is False ALLOWED_HOSTS = ['.my-domain.com'] 

Voir https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts

  • Utilisation de l'équilibreur de charge embeddede d'uWSGI vs nginx
  • Impossible de charger la configuration à partir de uwsgi
  • N'a reçu aucune réponse du server local dans la machine
  • "ImportError: Aucun module nommé flask" - Problème avec nginx + uWSGI + Flask dans une configuration virtualenv
  • Augmentation de la performance de nginx après 1k requirejs
  • Redémarrez l'application uWSGI unique (quand elle est en mode empereur)
  • Django (uWSGI) et php (fastcgi) NGINX
  • Câblage de uWSGI pour fonctionner avec Django et nginx sur Ubuntu 16.04
  • Comment puis-je ajouter un préfixe d'URL (/ wiki) à MoinMoin en cours d'exécution sur uWSGI et nginx?
  • Les journaux uWSGI de Python n'ont pas de droits de lecture
  • uWSGI ne peut pas find "application" à l'aide de Flask and Virtualenv
  • Les astuces du serveur de linux et windows, tels que ubuntu, centos, apache, nginx, debian et des sujets de réseau.