server
{
listen 80;
server_name abc.com;
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;
}
}
nginx 配置虚拟目录,并且支持PHP配置虚拟目录
最新推荐文章于 2024-01-25 15:18:12 发布