python nginx uwsgi - 请求的不可用修饰符:1 -

时间:2012-08-25 13:10:03

标签: python nginx uwsgi

我尝试在后端用uwsgi和python django启动nginx web服务器 系统ubuntu 12.04

但获得502 Bad Gateway和   - 请求的不可用修饰符:1 - 在日志中

我的nginx文件配置:

server {
listen 80;
server_name site.com;

charset utf-8;

access_log /var/log/nginx/tona-access.log;
error_log /var/log/nginx/tona-error.log;
client_max_body_size 100m;



location /main_media/ {
    alias  /home/se7en/workspace/tona/main_media/;
    expires 30d;
    }    

location / {

include /etc/nginx/uwsgi_params;
fastcgi_pass unix:///var/tmp/tona_uwsgi.sock;

}


}

我的uwsgi启动和控制台输出:

root@tona:/etc/nginx/sites-enabled# uwsgi --uid www-data --file uwsgi_app.py --plugins python --chdir /home/se7en/workspace/tona/ --pythonpath /home/se7en/workspace/tona/ --module uwsgi_app -c application --limit-as 128 -p 3 -M -s /var/tmp/tona_uwsgi.sock 
./python_plugin.so: cannot open shared object file: No such file or directory
*** Starting uWSGI 1.2.5 (32bit) on [Sat Aug 25 16:58:02 2012] ***
compiled with version: 4.6.3 on 24 August 2012 22:03:24
detected number of CPU cores: 1
current working directory: /etc/nginx/sites-enabled
detected binary path: /usr/local/bin/uwsgi
setuid() to 33
limiting address space of processes...
your process address space limit is 134217728 bytes (128 MB)
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
uwsgi socket 0 bound to UNIX address /var/tmp/tona_uwsgi.sock fd 3
Python version: 2.7.3 (default, Aug  1 2012, 05:27:35)  [GCC 4.6.3]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x9521058
your server socket listen backlog is limited to 100 connections
*** Operational MODE: preforking ***
added /home/se7en/workspace/tona/ to pythonpath.
WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x9521058 pid: 5764 (default app)
mountpoint  already configured. skip.
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 5764)
spawned uWSGI worker 1 (pid: 5765, cores: 1)
spawned uWSGI worker 2 (pid: 5766, cores: 1)
spawned uWSGI worker 3 (pid: 5767, cores: 1)
-- unavailable modifier requested: 1 --
-- unavailable modifier requested: 1 --
-- unavailable modifier requested: 1 --
-- unavailable modifier requested: 1 --

我的uwsgi_app.py文件:

import os
import sys
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

1 个答案:

答案 0 :(得分:0)

你必须使用--fastcgi-socket而不是-s(这是--socket的快捷方式)在fastcgi模式下设置uWSGI