map $http_x_forwarded_for $accessip {
default false;
10.10.10.10 true; #定义白名单
}
server {
listen 80;
server_name 127.0.0.1;
root html;
access_log logs/access.log main;
error_log logs/error.log;
#expires -1;
location /favicon.ico {
expires 30d;
}
location / {
if ( $accessip = 'false' ) {return 403;} #访问控制
try_files $uri @fallback;
}
}
原创文章,作者:254126420,如若转载,请注明出处:https://blog.ytso.com/245587.html