我正在寻找一种方法来将我的网站的特定区域的一组特定的IP地址列入白名单。
例如,我想只允许xxx.xxx.xxx.xxx访问“example.com/admin”,并拒绝所有其他的IP – 我认为这将发生在实际的服务器{}部分,但不知道在哪里和如何pipe理这个。
在另一个问题find了答案,适用于我… nginx通过ip限制目录访问
# This handles everything that starts with /restricted, # and no regex locations will override it location ^~ /restricted { allow 1.2.3.4; deny all; # This will inherit the allow/deny from the outer location location ~ \.php$ { include fastcgi.conf; fastcgi_pass backend; } }