nginx location 配置
location ~* /admin/login {
#set $my_ip '';
#if ( $http_x_forwarded_for !=client ip){set $my_ip 1;}
#if ( $http_x_forwarded_for != client ip ){ set $my_ip 1;}
#if ( $my_ip = 1) {
# return 302;
#}
#if ($http_x_forwarded_for != "ip1" ) {
#return 302;
#proxy_pass http://127.0.0.1:8080;
# }
if ( $http_x_forwarded_for !~ "ip1|ip2" ) { #不在ip1和ip2 允许列表中的 直接return 404 如果没有SLB 直接是 $remote_addr
return 404;
}
proxy_pass http://127.0.0.1:8080; #允许的直接通过代理到后端
}