发布网友
共2个回答
热心网友
启用FastCGI,安装php-fpm~
热心网友
nginx 配置虚拟目录,并且支持PHP配置虚拟目录
server
{
listen 80;
server_name www.5wx.org;
index index.php index.html index.htm;
access_log /var/log/nginx/test.abc.com.log;
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
location /transfer
{
root /alidata/www/transfer;
if (!-e $request_filename){
rewrite ^/index.php(.*)$ /index.php?s=$1 last;
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}
location /sms
{
root /alidata/www/sms;
if (!-e $request_filename){
rewrite ^/index.php(.*)$ /index.php?s=$1 last;
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}
location /
{
root /alidata/www/ant_nest;
#if (-f $request_filename) {
# expires max;
# break;
#}
if (!-e $request_filename){
rewrite ^/index.php(.*)$ /index.php?s=$1 last;
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}
location ~ .*\.(php|php5)?$
{
if ( $request_uri ~ "^/transfer/" ){
root /alidata/www/ant_nest2;
}
if ( $request_uri ~ "^/sms/" ){
root /alidata/www/ant_nest_sms;
}
root /alidata/www/default;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
add_header request_uri $request_uri;
break;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
if (-f $request_filename) {
expires -1s;
break;
}
}
location ~ /\.ht{
deny all;
}
}
---------------------