如果想禁止某一(类)链接的访问,可以通过配置nginx的conf配置文件来实现:

location ~ /application/(admin|index)/static/.$ {
allow all;
}
location ~ /(applicaion|addos|coe|dta)/.$ {
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;
}

原文地址:https://www.cnblogs.com/kuku0223/p/9389164.html

Last modification:July 21st, 2019 at 05:49 pm
如果觉得我的文章对你有用,请随意赞赏