Skip to content

Instantly share code, notes, and snippets.

@mosson
Last active December 25, 2015 16:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mosson/7008082 to your computer and use it in GitHub Desktop.
Save mosson/7008082 to your computer and use it in GitHub Desktop.
nginx IP制限 under ELB
# http://blog.techopsguru.com/2011/12/access-control-behind-amazon-elb-with-nginx.html
map $http_x_forwarded_for $allowed {
default deny;
~*^23.24.25.26\s.* allow; # office external IP
~*^8.8.8.8\s.* allow; # internal.example.com
~*^9.0.2.1\s.* allow; # some user home IP
}
# restrict access to admin console (vhost part)
location /admin {
if ( $allowed = "deny" ) {
return 403 ;
}
try_files $uri @rails ;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment