首页 > linux, 我的网站 > nginx 的配置

nginx 的配置

2008年11月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了,经过感觉,速度好像是快了点。继续测试中。

linux, 我的网站 , , ,