nginx-添加禁止访问规则


location ~* /application/(admin|index)/static/.*$ {
allow all;
}

location ~* /(applicaion|addos|coe|dta)/.*$ {
deny all; 禁止访问
}

location ~* /(.git|.svn) {
deny all;
}

if ($http_cdn_src_ip ~ 'IP1|IP2|IP3' ) {
return 403;
}

#禁止访问以下目录的php
location ~* /(caches|include|statics|uploadfile)/.*\.(php|php5|php4)$ {
deny all;
}
location ~* /user/(caches|include|upfile|statics)/.*\.(php|php5|php4)$ {
deny all;
}
#禁止访问以下目录的html
location ~* /(caches|include|uploadfile)/.*\.(html|htm|phtml|phtm|txt)$ {
deny all;
}
location ~* /user/(caches|include|upfile|statics)/.*\.(html|htm|phtml|phtm|txt)$ {
deny all;
}

#不允许使用IP直接访问 只能使用域名访问网站

server{
listen 80 default_server;
server_name _;
return 403;
}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM