系统相关
首页 > 系统相关> > nginx 子目录执行php

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;
}
}

标签:index,set,pathinfo,子目录,nginx,scriptname,php,fastcgi
来源: https://www.cnblogs.com/linuxOS/p/15422356.html