-
- nginx上用uwsgi跑python,用fpm跑php
- 2015-04-22
还是给自己备忘用的
1.安装nginx就不说了
2. 安装uwsgi
apt-get install uwsgi-core uwsgi-plugin-python
然后配置uwsgi的启动,
[uwsgi]
#uid = www-data
#gid = www-data
plugins = cgi
http-modifier1 = 0
socket = 127.0.0.1:
chdir = /var/wwwroot/
wsgi-file = /path/to/your/dir/app.py
cgi-helper=.py=python然后再配置supervisor来监控uwsgi的进程就可以了,顺便可以把supervisor加入到upstart达一开机自动启动的目的。
3.nginx这边把请求丢给uwsgi就行了。
serve python with uwsgi$
location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:9000;
}4.然后是php,当然要先安装
apt-get php5-common php5-fpm php5-gd(这个是图片处理的,根据需要安装)
然后去修改nginx的配置 /etc/nginx/fastcgi_params(参考http://wiki.nginx.org/PHPFcgiExample)
这个文件里默认的少两个参数,将下面两行加进去就行
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;然后修改nginx的host配置,让php通过fastcgi跑起来
location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$; if (!-f $document_root$fastcgi_script_name) { return 404; }
fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; }-
Views(12727) | Comments(0) |
In:
web develop
Python相关
Linux Server
|

使用supervisor进行进程监控和自启动管理
(05/23)
