本教程操作环境:windows7系统、PHP8.1版、Dell G3电脑。lnmp 怎么隐藏index.php?lnmp启用pathinfo并隐藏index.php编辑如下区段:location ~ [^/].php(/|$) {
本教程操作环境:windows7系统、PHP8.1版、Dell G3电脑。
lnmp 怎么隐藏index.php?
lnmp启用pathinfo并隐藏index.php
编辑如下区段:
location ~ [^/].php(/|$)
{
# comment try_files $uri =404; to enable pathinfo
try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
#include pathinfo.conf;
}
第1行改为:
location ~ [^/].php
第4行注释掉, 即前面加#
#try_files $uri =404;
去掉第8行的注释
include pathinfo.conf;
在location ~ [^/].php 上面添加区段
location /
{
if (!-e $request_filename)
{
rewrite "^/(.*)$" /index.php last;
}
}
重启Nginx
service nginx restart
以上就是lnmp 怎么隐藏index.php的详细内容,更多请关注编程网其它相关文章!
--结束END--
本文标题: lnmp 怎么隐藏index.php
本文链接: https://www.lsjlt.com/news/99225.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0