- 1.打开php.ini 使php支持pathinfo模式,cgi.fix_pathinfo=1;
- 2.打开nginx.conf,在server中增加如下重写规则,
- 根目录
- location / {
- if (!-e $request_filename){
- rewrite ^/(.*)$ /index.php?s=$1 last;
- }
- }
- 若为二级目录如下
- location /subdir/ {
- if (!-e $request_filename){
- rewrite ^/subdir/(.*)$ /subdir/index.php?s=$1 last;
- }
- }
3.重启lnmp;
4.访问地址去掉index.php
thinkphp nginx 下无法访问控制器
最新推荐文章于 2025-11-01 01:38:55 发布
本文介绍如何通过修改php.ini和nginx.conf文件配置LNMP环境以支持URL重写,包括开启PHP Pathinfo模式、设置Nginx重写规则及重启LNMP服务等步骤。
1098

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



