配置nginx1.8支持thinkPHP3.2 pathinfo模式

时间:2023-03-09 09:26:53
配置nginx1.8支持thinkPHP3.2 pathinfo模式

  nginx 下conf/nginx.conf 或者自己的vhosts
更改以前的参数

location / {

root   html;

index  index.html index.htm index.php;

try_files  $uri  /index.php$uri;

if (!-e $request_filename) {

rewrite ^/子目录名/(.*)$ /子目录名/index.php?s=$1 last; #去除index.php

break;

}

}

location ~ .+\.php($|/) {

root           html;

fastcgi_pass   127.0.0.1:9000;

fastcgi_index  index.php;

fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

fastcgi_split_path_info  ^(.+\.php)(/.*)$;

fastcgi_param  PATH_INFO $fastcgi_path_info;

include        fastcgi_params;

}