最近测试怎么在nginx 中通过固定IP来访问某个地址,话不多说直接上代码:
location ^~ /
{
if ($request_uri ~ /)
{
set $bucketid $1;
}
if ($remote_addr ~* "192.168.114.146|192.168.114.145|192.168.114.144|192.168.11.51|192.168.11.125|192.168.58.3|192.168.11.42")
{
proxy_pass http://192.168.113.168:9085$1;
}
if ($remote_addr ~* "192.168.11.64")
{
proxy_pass http://192.168.113.167:9085$1;
}
include proxy.conf;
access_log logs/web.log main;
}
转载于:https://blog.51cto.com/liuyusheng/1770622