nginx 子目录执行php

location ^~ /sub/ {
set $subroot /home/www/sv8/wwwroot/;
root $subroot;
index index.php index.html;

location ~ \.php {
fastcgi_pass php5:9000;
set $scriptname '';
set $pathinfo '';

if ( $uri ~ ^/sub/(.+\.php)($|/.+) ) {
set $scriptname $1;
set $pathinfo $2;
}

fastcgi_param SCRIPT_FILENAME /home/www/sv8/wwwroot/$scriptname;
fastcgi_index index.php?IF_REWRITE=1;
fastcgi_param PATH_INFO $pathinfo;
include fastcgi_params;
}
}

posted @ 2021-10-18 21:16  3000  阅读(254)  评论(0编辑  收藏  举报