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