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;
}

posted @ 2018-07-30 10:18  划得戳  阅读(5705)  评论(0编辑  收藏  举报