linux下nginx+python配置,以下文章只记录了重点部分
mod_wsgi下载
http://hg.mperillo.ath.cx/nginx/mod_wsgi/archive/tip.tar.gz
1.Nginx安装
./configure --add-module=/path/to/mod_wsgi/ \
--prefix=/usr/local/nginx
make
make install
2.mod_wsgi安装
cd mod_wsgi-0.0.6/
Python setup.py –prefix=/usr/local/nginx –conf-path=/usr/local/nginx/conf –sbin-path=/usr/local/nginx/sbin
3.修改Nginx.conf文件 #user nobody;
worker_processes 4;
error_log logs/error.log info;
pid logs/nginx.pid;
events {
use epoll; #linux2.6+
worker_connections 2048;
}
env HOME;
env PythonPATH=/www/web/py;
env Python_EGG_CACHE=/tmp;
http {
include conf/mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip off;
wsgi_Python_optimize 2;
wsgi_Python_executable /usr/bin/Python;
#wsgi_Python_home /usr;
#wsgi_enable_subinterpreters on;
server {
listen 80;
server_name localhost;
include conf/wsgi_vars;
#wsgi_middleware wsgiref.validate validator;
#wsgi_middleware paste.lint;
location / {
root /www/web/py;
}
location /do {
#client_body_buffer_size 50;
wsgi_pass /www/web/py/nginx.py;
wsgi_pass_authorization off;
wsgi_script_reloading on;
wsgi_use_main_interpreter on;
}
}
}
done! |