Home > Backend Development > PHP Problem > How to configure nginx index.php to hide

How to configure nginx index.php to hide

藏色散人
Release: 2023-03-06 21:26:01
Original
3553 people have browsed it

nginx配置index.php隐藏的方法:首先找到并打开“nginx.conf”配置文件;然后添加代码为“location / {if (!-e $request_filename) {...}}”并保存即可。

How to configure nginx index.php to hide

推荐:《PHP视频教程

ThinkPHP5.0的nginx配置隐藏入口文件index.php

只需要在配置文件nginx.conf添加下面这串代码

location / {                                   
         if (!-e $request_filename) {        
           rewrite ^/(.*)$ /index.php/?s=$1 last;
           break;
            }
        }
Copy after login

如下图红色框框部分

How to configure nginx index.php to hide

PS:宝塔linux面板的nginx隐藏入口文件,需要在网站--当前站点的设置--配置文件下  增加上面那串代码(亲测有效)

The above is the detailed content of How to configure nginx index.php to hide. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template