服务器维护,服务器代维,安全设置,漏洞扫描,入侵检测服务

运维之家

 找回密码
 注册
搜索
查看: 4326|回复: 0

nginx+python配置

[复制链接]
dirtysea 发表于 2010-7-23 17:07:18 | 显示全部楼层 |阅读模式
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!

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|小黑屋|手机版|Archiver|运维之家

GMT+8, 2024-3-29 03:22 , Processed in 0.138036 second(s), 14 queries .

Powered by Dirtysea

© 2008-2020 Dirtysea.com.

快速回复 返回顶部 返回列表