我在单个管理页面上面临 502 Bad Gateway 错误:http: //Domain.com/admin/sitecategory/add/
尽管所有其他管理页面都工作正常。我检查了 django 日志,没有错误。我运行了 django 测试服务器,该特定页面也运行良好。
nginx日志:
2013/06/15 13:37:01 [error] 1906#0: *4431 upstream prematurely closed connection while reading response header from upstream, client: 46.185.176.26, server: staging.myapp.com, request: "GET /admin/sitecategory/add/ HTTP/1.1", upstream: "uwsgi://unix:///tmp/myapp-staging.socket:", host: "staging.myapp.com", referrer: "http://staging.myapp.com/admin/sitecategory/"
uwsgi 日志:
*** HARAKIRI ON WORKER 1 (pid: 1942, try: 1) ***
*** backtrace of 1942 ***
uwsgi(uwsgi_backtrace+0x25) [0x43ed95]
uwsgi(what_i_am_doing+0x17) [0x43eeb7]
/lib64/libc.so.6(+0x32920) [0x7fec48662920]
/usr/lib64/libpython2.6.so.1.0(PyEval_EvalFrameEx+0x2ee6) [0x7fec48cd64a6]
/usr/lib64/libpython2.6.so.1.0(PyEval_EvalCodeEx+0x8de) [0x7fec48cd9c7e]
/usr/lib64/libpython2.6.so.1.0(PyEval_EvalFrameEx+0x50ad) [0x7fec48cd866d]
/usr/lib64/libpython2.6.so.1.0(PyEval_EvalCodeEx+0x8de) [0x7fec48cd9c7e]
/usr/lib64/libpython2.6.so.1.0(+0x6ecbb) [0x7fec48c68cbb]
/usr/lib64/libpython2.6.so.1.0(PyObject_Call+0x53) [0x7fec48c41243]
/usr/lib64/libpython2.6.so.1.0(PyEval_EvalFrameEx+0x2a1b) [0x7fec48cd5fdb]
/usr/lib64/libpython2.6.so.1.0(PyEval_EvalCodeEx+0x8de) [0x7fec48cd9c7e]
/usr/lib64/libpython2.6.so.1.0(PyEval_EvalFrameEx+0x50ad) [0x7fec48cd866d]
/usr/lib64/libpython2.6.so.1.0(PyEval_EvalFrameEx+0x54ef) [0x7fec48cd8aaf]
/usr/lib64/libpython2.6.so.1.0(PyEval_EvalCodeEx+0x8de) [0x7fec48cd9c7e]
/usr/lib64/libpython2.6.so.1.0(PyEval_EvalFrameEx+0x50ad) [0x7fec48cd866d]
/usr/lib64/libpython2.6.so.1.0(PyEval_EvalCodeEx+0x8de) [0x7fec48cd9c7e]
/usr/lib64/libpython2.6.so.1.0(PyEval_EvalFrameEx+0x50ad) [0x7fec48cd866d]
/usr/lib64/libpython2.6.so.1.0(PyEval_EvalCodeEx+0x8de) [0x7fec48cd9c7e]
/usr/lib64/libpython2.6.so.1.0(+0x6ecbb) [0x7fec48c68cbb]
/usr/lib64/libpython2.6.so.1.0(PyObject_Call+0x53) [0x7fec48c41243]
/usr/lib64/libpython2.6.so.1.0(PyEval_EvalFrameEx+0x2a1b) [0x7fec48cd5fdb]
/usr/lib64/libpython2.6.so.1.0(PyEval_EvalCodeEx+0x8de) [0x7fec48cd9c7e]
/usr/lib64/libpython2.6.so.1.0(PyEval_EvalFrameEx+0x50ad) [0x7fec48cd866d]
/usr/lib64/libpython2.6.so.1.0(PyEval_EvalCodeEx+0x8de) [0x7fec48cd9c7e]
/usr/lib64/libpython2.6.so.1.0(PyEval_EvalFrameEx+0x50ad) [0x7fec48cd866d]
/usr/lib64/libpython2.6.so.1.0(PyEval_EvalCodeEx+0x8de) [0x7fec48cd9c7e]
/usr/lib64/libpython2.6.so.1.0(+0x6ebc7) [0x7fec48c68bc7]
/usr/lib64/libpython2.6.so.1.0(PyObject_Call+0x53) [0x7fec48c41243]
/usr/lib64/libpython2.6.so.1.0(PyObject_CallFunctionObjArgs+0xb0) [0x7fec48c41bb0]
/usr/lib64/libpython2.6.so.1.0(PyObject_Unicode+0x6a) [0x7fec48c7dc6a]
/usr/lib64/libpython2.6.so.1.0(+0xb4c6a) [0x7fec48caec6a]
/usr/lib64/libpython2.6.so.1.0(+0x9e633) [0x7fec48c98633]
/usr/lib64/libpython2.6.so.1.0(PyObject_Call+0x53) [0x7fec48c41243]
/usr/lib64/libpython2.6.so.1.0(PyEval_EvalFrameEx+0x39ab) [0x7fec48cd6f6b]
/usr/lib64/libpython2.6.so.1.0(PyEval_EvalCodeEx+0x8de) [0x7fec48cd9c7e]
/usr/lib64/libpython2.6.so.1.0(PyEval_EvalFrameEx+0x50ad) [0x7fec48cd866d]
/usr/lib64/libpython2.6.so.1.0(PyEval_EvalFrameEx+0x54ef) [0x7fec48cd8aaf]
*** end of backtrace ***
HARAKIRI: --- uWSGI worker 1 (pid: 1942) WAS managing request /admin/sitecategory/add/ since Sat Jun 15 16:36:49 2013 ---
[pid: 1818|app: 0|req: 5/5] 46.185.176.26 () {38 vars in 694 bytes} [Sat Jun 15 16:37:01 2013] GET /favicon.ico => generated 5939 bytes in 113 msecs (HTTP/1.1 404) 1 headers in 51 bytes (1 switches on core 0)
*** HARAKIRI ON WORKER 1 (pid: 1942, try: 2) ***
DAMN ! worker 1 (pid: 1942) died, killed by signal 9 :( trying respawn ...
我使用 upstart 运行 uwsgi:
exec uwsgi -b 25000 --chdir=/www/python/apps/myapp-staging/ --module=wsgi:application --env DJANGO_SETTINGS_MODULE=settings --socket=/tmp/myapp-staging.socket --processes=3 --harakiri=10 --max-requests=5000 --vacuum --master --pidfile=/tmp/myapp-staging-master.pid --uid=220 --gid=499 --daemonize=/www/uwsgi/myapp-staging.log
我的 nginx 配置如下:
server {
server_name staging.myapp.com;
root /www/python/apps/myapp-staging/;
access_log /www/nginx/staging.myapp.com.access.log;
error_log /www/nginx/staging.myapp.com.error.log;
location /static/ {
alias /www/python/apps/myapp-staging/static/;
expires 30d;
}
location /media/ {
alias /www/python/apps/myapp-staging/media/;
expires 30d;
}
location / {
uwsgi_pass unix:///tmp/myapp-staging.socket;
include uwsgi_params;
proxy_read_timeout 360;
}
}
在这里做错什么了吗?
谢谢