nginx conf
server {
listen 80;
server_name status.example.com;
charset utf-8;
location / {
proxy_pass http://192.168.1.167:3001;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
现在想要 限制只允许同内网的机器访问 ,尝试过添加
# 优先允许内网中的特定 IP 地址
allow 192.168.0.199; # 或者你想要允许的内网 IP 地址
# 接着允许特定网段的 IP 范围访问
allow 192.168.0.0/23;
# 最后拒绝所有其他 IP 地址
deny all;
但是测试发现要么都是允许要么都是 403
网络路径是 status.example.com > 123.123.666.666 > 深信服 > 内网机器(nginx)