#重写url,不带index.php
if (!-e $request_filename) {
rewrite ^.*$ /index.php last;
}
#nginx支持PATH_INFO
location ~ \.(php|php5) {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include /etc/nginx/vhosts/fastcgi_params;
}
php框架PATH_INFO模式配置
最新推荐文章于 2022-02-12 14:13:15 发布
本文介绍了如何使用 Nginx 进行 URL 重写,去除 index.php 并支持 PATH_INFO 的配置方法。通过示例展示了具体的 Nginx 配置规则,有助于实现更简洁的 URL 结构。

1万+

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



