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

浙公網安備 33010602011771號