upstream django { server unix:///home/test/warehouse/war.sock; } server { listen 80; server_name server.com; location / { uwsgi_pass django; } location /static { alias /home/test/warehouse/static; } location /media { alias /home/test/warehouse/warehouse/media; } }
uwsgi --socket war.sock --module warehouse.wsgi --chmod-socket=664
Traceback (most recent call last): File "/usr/local/lib/python3.4/site-packages/django/core/handlers/wsgi.py", line 179, in __call__ request = self.request_class(environ) File "/usr/local/lib/python3.4/site-packages/django/core/handlers/wsgi.py", line 101, in __init__ self.method = environ['REQUEST_METHOD'].upper() KeyError: 'REQUEST_METHOD' [pid: 4288|app: 0|req: 2/2] () {16 vars in 499 bytes} [Thu May 14 07:40:38 2015] => generated 0 bytes in 1 msecs ( 500) 0 headers in 0 bytes (0 switches on core 0)
502 Bad Gateway nginx/1.0.15
uwsgi --http :8000 --module warehouse.wsgi
При запуске через:
uwsgi --socket :8001 --module warehouse.wsgi
и конфиге nginx:
upstream django { #server unix:///home/test/warehouse/war.sock; server 127.0.0.1:8001; }
Та-же ошибка.
В логах nginx:
2015/05/14 11:04:25 [error] 4996#0: *1 upstream prematurely closed connection while reading response header from upstream, client: 10.168.1.116, server: server.com, request: "GET / HTTP/1.1", upstream: "uwsgi://127.0.0.1:8001", host: "*.*.*.*"
вот что выдаёт uwsgi при запуске:
$ uwsgi --socket :8001 --module warehouse.wsgi *** Starting uWSGI 2.0.10 (64bit) on [Thu May 14 13:06:22 2015] *** compiled with version: 4.4.7 20120313 (Red Hat 4.4.7-11) on 13 May 2015 12:40:46 os: Linux-2.6.32-504.16.2.el6.x86_64 #1 SMP Wed Apr 22 06:48:29 UTC 2015 nodename: autotest machine: x86_64 clock source: unix pcre jit disabled detected number of CPU cores: 2 current working directory: /home/test/warehouse detected binary path: /usr/local/bin/uwsgi *** WARNING: you are running uWSGI without its master process manager *** your processes number limit is 1024 your memory page size is 4096 bytes detected max file descriptor number: 1024 lock engine: pthread robust mutexes thunder lock: disabled (you can enable it with --thunder-lock) uwsgi socket 0 bound to TCP address :8001 fd 3 Python version: 3.4.2 (default, Mar 13 2015, 12:50:41) [GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] *** Python threads support is disabled. You can enable it with --enable-threads *** Python main interpreter initialized at 0x1b59760 your server socket listen backlog is limited to 100 connections your mercy for graceful operations on workers is 60 seconds mapped 72768 bytes (71 KB) for 1 cores *** Operational MODE: single process *** WSGI app 0 (mountpoint='') ready in 1 seconds on interpreter 0x1b59760 pid: 8937 (default app) *** uWSGI is running in multiple interpreter mode *** spawned uWSGI worker 1 (and the only) (pid: 8937, cores: 1)