Last active
August 29, 2015 14:14
-
-
Save jun-ya/cfc3a11a878700dbf209 to your computer and use it in GitHub Desktop.
GitLab CE OmnibusバンドルのnginxにIPアクセス制限機能を付ける ref: http://qiita.com/jun_ya/items/e748ae4d376956aa9dbd
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
location / { | |
## Serve static files from defined root folder. | |
## @gitlab is a named location for the upstream fallback, see below. | |
try_files $uri $uri/index.html $uri.html @gitlab; | |
} |
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
location / { | |
<% if @ip_access_control %> | |
<% @allow_ips.each do |allow_ip| %> | |
allow <%= allow_ip %>; | |
<% end %> | |
<% @deny_ips.each do |deny_ip| %> | |
deny <%= deny_ip %>; | |
<% end %> | |
<% end %> | |
## Serve static files from defined root folder. | |
## @gitlab is a named location for the upstream fallback, see below. | |
try_files $uri $uri/index.html $uri.html @gitlab; | |
} |
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
nginx['ip_access_control'] = true | |
nginx['allow_ips'] = ["アクセス許可したいIPその1","アクセス許可したいIPその2" ....] | |
nginx['deny_ips'] = ["アクセス拒否したいIPその1","アクセス拒否したいIPその2" ....] |
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
nginx['ip_access_control'] = true | |
nginx['allow_ips'] = ["172.16.1.0/24"] | |
nginx['deny_ips'] = ["all"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment