linux下nginx+python配置
七月 17th, 2010 Posted in Nginx | 163次浏览
Author:gaojinbo
Time:2010-7-17
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!
Tags: python
七月 18th, 2010 at 12:43
博主的主题很不错呀
七月 18th, 2010 at 22:14
。。。 说实话 天天看你的站 感觉 你天天都在电脑上折腾。。
可怜的ubuntu 感觉还是debian更合适你一些…
顺便说一句 我的网站回来了 osmsg.com 过来看看
七月 19th, 2010 at 12:24
兄弟,把我的链接改一下啊,http://www.ningyi.org,谢谢。呵呵
七月 20th, 2010 at 21:29
宁怡 好的,链接已成功修改:)
七月 20th, 2010 at 21:30
nsdy 你的站东西很好,技术文章少了点
八月 8th, 2010 at 11:26
你好博主,这个配置是在哪个版本的nginx下成功的呢?我用近期的版本都无法编译成功,能configure,但编译nginx时出错,是mod_wsgi的src里面一个文件出错
八月 9th, 2010 at 09:38
能configure,但编译nginx时出错
得把你的错误提示贴出来,才知道是哪里出了问题,这个问题相信你能搞定