tp-nginx-config
server
{
# 适用于 thinkphp 3.2 thinkphp 5.0
# pathinfo 模式
# 模块/控制器/方法/参数
# 3.2 使用方法 /home/index/index/params
# 5.0 使用方法 /index/index/index/params
listen 80;
server_name tp;#mod this line
index index.php index.html;
root /tpdir; #mod this line
location / {
index index.php index.htm;
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php/$1 last;
break;
}
}
location ~ \.php {
fastcgi_pass 127.0.0.1:9000; #mod this line
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
if ($fastcgi_script_name ~ “^(.+?\.php)(/.+)$”) {
set $real_script_name $1;
set $path_info $2;
}
fastcgi_param PATH_INFO $path_info;
}
}