Home > php教程 > php手册 > nginx安全配置之白名单设置

nginx安全配置之白名单设置

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 11:42:54
Original
1688 people have browsed it

针对php设置一个可执行的白名单,对于服务器安全来说也是一种必要而重要的设置。
其他的不多说,直接上配置明细吧:server {<br>     listen       5080;<br>     server_name  www.example.com;<br> <br>     root         /home/htdocs/app/;<br>     index        index.php;<br> <br>     location / {<br>         try_files $uri $uri/ /index.php?s=$uri;<br>     }<br> <br>     location ~ .*\.php$ {<br>         # 白名单配置,只允许/index.php访问<br>         if ($fastcgi_script_name !~* "^/(index)\.php$") {<br>             return 403;<br>         }<br>         fastcgi_pass   127.0.0.1:9000;<br>         fastcgi_index  index.php;<br>         include        fcgi.conf;<br>     }<br> }PS:发现发错地方了,请移动至话题讨论区去,感谢!

AD:真正免费,域名+虚机+企业邮箱=0元

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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template