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

dirtysea 发表于 2010-8-19 17:43:54

linux下nginx+python配置

<P>linux下nginx+python配置,以下文章只记录了重点部分 </P>
<P>&nbsp;</P>
<P>mod_wsgi下载 <BR><PRE>http://hg.mperillo.ath.cx/nginx/mod_wsgi/archive/tip.tar.gz</PRE>
<P>&nbsp;</P>
<P>1.Nginx安装 </P>
<P></P><PRE>./configure --add-module=/path/to/mod_wsgi/ \
--prefix=/usr/local/nginx
make
make install </PRE>
<P>&nbsp;</P>
<P><BR>2.mod_wsgi安装 </P>
<P>cd mod_wsgi-0.0.6/ </P>
<P>Python setup.py –prefix=/usr/local/nginx –conf-path=/usr/local/nginx/conf –sbin-path=/usr/local/nginx/sbin </P>
<P>&nbsp;</P>
<P>3.修改Nginx.conf文件 </P><PRE>#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;
}

}

} </PRE>
<P></P>
<P>done!</P>
页: [1]
查看完整版本: linux下nginx+python配置