Nginx 访问控制权限及状态码查看

 

 [root@localhost ~]# vim /usr/local/nginx/conf/nginx.conf            添加如下蓝色部分配置,你想拒绝谁就添加谁

location / {
root html;
index index.html index.htm;
deny 192.168.2.101;
allow all;
}

[root@localhost ~]# curl -i 192.168.2.107         测试 使用本机可访问
HTTP/1.1 200 OK
Server: nginx/1.16.1
Date: Tue, 27 Oct 2020 12:53:10 GMT
Content-Type: text/html
Content-Length: 612
Last-Modified: Mon, 26 Oct 2020 12:35:43 GMT
Connection: keep-alive
ETag: "5f96c29f-264"
Accept-Ranges: bytes

posted @ 2020-10-27 20:58  insi2020  阅读(490)  评论(0编辑  收藏  举报