location / {
if (!-e $request_filename) {
#rewrite ^(.*)$ /index.php?s=$1 last;
rewrite ^/think/tp/public/(.*)$ /think/tp/public/index.php/$1 last;
break;
}
}
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
try_files $fastcgi_script_name =404;
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
本文详细解析了Nginx中location块的配置方法,包括如何使用rewrite指令进行URL重写,以及如何设置PHP文件的FastCGI处理。通过具体实例,展示了如何实现路径重写、错误页设置及FastCGI参数传递。
1038

被折叠的 条评论
为什么被折叠?



