Last active
December 25, 2015 16:48
-
-
Save mosson/7008082 to your computer and use it in GitHub Desktop.
nginx IP制限 under ELB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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