Skip to content

Instantly share code, notes, and snippets.

@jun-ya
Last active August 29, 2015 14:14
Show Gist options
  • Save jun-ya/cfc3a11a878700dbf209 to your computer and use it in GitHub Desktop.
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
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;
}
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;
}
nginx['ip_access_control'] = true
nginx['allow_ips'] = ["アクセス許可したいIPその1","アクセス許可したいIPその2" ....]
nginx['deny_ips'] = ["アクセス拒否したいIPその1","アクセス拒否したいIPその2" ....]
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