本文共 370 字,大约阅读时间需要 1 分钟。
需求:访问/admin/目录的请求,只允许某几个IP访问,配置如下:
location /admin/
{ allow 192.168.133.1; #允许访问的ip地址allow 127.0.0.1; #允许访问的ip地址deny all;}mkdir /data/wwwroot/test.com/admin/
echo “test,test”>/data/wwwroot/test.com/admin/1.html
-t && -s reload
curl -x127.0.0.1:80 test.com/admin/1.html -I
curl -x192.168.133.130:80 test.com/admin/1.html -I
转载于:https://blog.51cto.com/13451715/2324061