一、设置目录限制访问,返回403
location /xxx {
return 403;
if_modified_since off;
add_header Last-Modified "";
proxy_read_timeout 300;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
二、允许特定ip访问目录
location /nginx-status {
stub_status on;
access_log off;
#指定网管服务器可以访问
allow xxx.xxx.xxx.xxx;
allow xxx.xxx.xxx.xxx;
allow xxx.xxx.xxx.xxx;
#限制其它IP访问
deny all;
}



