linux下nginx+python配置

七月 17th, 2010 Posted in Nginx | 阅读次数: 735 次

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:

16 Responses to “linux下nginx+python配置”

  1. 深圳酒店 Says:

    博主的主题很不错呀


  2. nsdy Says:

    。。。 说实话 天天看你的站 感觉 你天天都在电脑上折腾。。
    可怜的ubuntu 感觉还是debian更合适你一些…

    顺便说一句 我的网站回来了 osmsg.com 过来看看


  3. 宁怡 Says:

    兄弟,把我的链接改一下啊,http://www.ningyi.org,谢谢。呵呵


  4. admin Says:

    宁怡 好的,链接已成功修改:)


  5. admin Says:

    nsdy 你的站东西很好,技术文章少了点


  6. pugwoo Says:

    你好博主,这个配置是在哪个版本的nginx下成功的呢?我用近期的版本都无法编译成功,能configure,但编译nginx时出错,是mod_wsgi的src里面一个文件出错


  7. gaojinbo Says:

    能configure,但编译nginx时出错

    得把你的错误提示贴出来,才知道是哪里出了问题,这个问题相信你能搞定 :)


  8. hongyuan Says:

    “/path/to/mod_wsgi/” 如何理解啊?


  9. gaojinbo Says:

    /path/to/mod_wsgi/ 模块路径


  10. Cure Yeast Infection Says:

    Recommended Sites…

    [...]below you’ll see my recommended links page http://www.yeastinfectiontreatmentcure.net/links/ with some excellent websites that I think you should definitely visit[...]…


  11. thoughts Says:

    Websites you should visit…

    [...]below you’ll find the link to some sites that we think you should visit[...]……


  12. militare ordine del collare Says:

    Recent Blogroll Additions……

    [...]usually posts some very interesting stuff like this. If you’re new to this site[...]……


  13. hotels in zurich Says:

    You should check this out……

    [...] Wonderful story, reckoned we could combine a few unrelated data, nevertheless really worth taking a look, whoa did one learn about Mid East has got more problerms as well [...]………


  14. Hotels in Venice Says:

    WOW! check this out!……

    Amazing Post, worth a read……


  15. asigurari locuinte Says:

    Gems form the internet…

    [...]very few websites that happen to be detailed below, from our point of view are undoubtedly well worth checking out[...]……


  16. Texans Saints Tickets Says:

    Online Article……

    [...]The information mentioned in the article are some of the best available [...]……


留下您的脚印