nginx 的配置

Web、Mail、Ftp、DNS、Proxy、VPN、Samba、LDAP 等基础网络服务
回复
头像
ssjjxx000
帖子: 201
注册时间: 2006-01-09 9:41
来自: 湖南邵东

nginx 的配置

#1

帖子 ssjjxx000 » 2009-06-10 9:22

加入了php的支持,nginx使用的是fastcgi。

我使用的是centos5.2系统,其中已经通过yum安装了php,因为不想再自己重新编译了就采用spawn-fcgi的方式来做fastcgi,spawn-fcgi包含在lighttpd,

wget lighttpd

./configure;

make;

cp src/spawn-fcgi /usr/bin/spawn-fcgi

spawn-fcgi -a 127.0.0.1 -p 9000 -C 5 -u nobody -g nobody -f /usr/bin/php-cgi

加入开机启动

nginx 配置

加入了rewrite来做永久链接

server {
listen 222.132.76.204:80;
server_name www.wangjian.info;
access_log /export/hd1/weblog/gpsview.access.log main;

location / {
root /export/hd1/web/blog/;
index index.php;

if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite (.*) /index.php;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /export/hd1/web/blog$fastcgi_script_name;
include fastcgi_params;
}
}
}

OK了,经过感觉,速度好像是快了点。继续测试中。
回复