我有一台物理服务器,在nginx中运行多个server
块,分别对应于不同的子域。我只想从其中之一访问与服务器位于同一局域网中的设备。我知道理论上可以使用
allow 192.168.1.0/24;
deny all;
在location
块中。但是,当我实际尝试从本地设备访问服务器时,请求被拒绝。查看访问日志,这是因为该请求显示为来自我的网络的外部IP,而不是设备的内部IP。我该如何解决?
答案 0 :(得分:1)
您的问题可能是您正在使用外部DNS,该外部DNS将您的请求路由到公共IP,然后又返回到您的网站。设置内部DNS,并将站点分辨率直接指向内部IP。
然后如您所述,您可以执行以下操作:
.menu configure -background color
.menu configure -foreground color
.menu configure -activebackground color
.menu configure -activeforeground color
.menu configure -disabledforeground color
.menu configure -font namedfont
.menu configure -selectcolor color
.menu configure -activeborderwidth size
site.conf:
cat << 'EOF' >/etc/nginx/private.conf
allow 192.168.1.0/24;
deny all;
EOF