nginx location 配置nginx
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; #容許的直接經過代理到後端後端
}代理