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