您好,欢迎访问一九零五行业门户网

nginx安全配置之白名单设置

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

推荐信息