分类: LINUX
2011-11-11 20:05:07
1.在nginx.conf里把每个虚拟主机站点请求端口给区别开
server {
listen 80;
server_name
index index.html index.htm index.php;
root /var/www/test;#limit_conn crawler 20;
location ~ .*.(php|php5)?$ {
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
}
}
server {
listen 80;
server_name
index index.html index.htm index.php;
root /var/www/test1;
#limit_conn crawler 20;
location ~ .*.(php|php5)?$ {
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9001;
fastcgi_index index.php;
include fcgi.conf;
}
}
在/usr/local/php/etc/找到php_defines,添加
在/usr/local/php/etc/nginx.org.conf找到php_defines,添加
修改为
#/usr/local/php/sbin/php-fpm start#/usr/local/nginx/sbin/nginx
#netstat -tlnp
开了9000 9001俩个不同的端口分开处理两个站点请求,两个php-cgi主进程加载不同的conf文件,实验成功.当然,启动之前记得conf里面的max_children,开启php-cgi子进程数,相应要减少一些,以免造成内存不足
补充:
spawn-fcgi -a 127.0.0.1 -p 9000 -C 9 -u www -f “/usr/local/php/bin/php-cgi -d open_basedir=/var