Commit 8b96c028841383630286d0daf79fa482efaa678b

Authored by Jacob Vosmaer
2 parents c8368bbf 2ac7eb9e

Merge branch 'master' into 'master'

Add parameter to tell nginx what IP address to bind on

This adds a parameter to set the IP address nginx listens on, so you don't have to dedicate ports 80/443 of all addresses on a box to gitlab.

The default is set to '*' which was hard-coded before.
files/gitlab-cookbooks/gitlab/attributes/default.rb
... ... @@ -210,3 +210,4 @@ default['gitlab']['nginx']['redirect_http_to_https'] = false
210 210 default['gitlab']['nginx']['redirect_http_to_https_port'] = 80
211 211 default['gitlab']['nginx']['ssl_certificate'] = "/etc/gitlab/ssl/#{node['fqdn']}.crt"
212 212 default['gitlab']['nginx']['ssl_certificate_key'] = "/etc/gitlab/ssl/#{node['fqdn']}.key"
  213 +default['gitlab']['nginx']['listen_address'] = '*'
... ...
files/gitlab-cookbooks/gitlab/templates/default/nginx-gitlab-http.conf.erb
... ... @@ -21,7 +21,7 @@ upstream gitlab {
21 21  
22 22 <% if @https && @redirect_http_to_https %>
23 23 server {
24   - listen *:<%= @redirect_http_to_https_port %>;
  24 + listen <%= @listen_address %>:<%= @redirect_http_to_https_port %>;
25 25 server_name <%= @fqdn %>;
26 26 server_tokens off;
27 27 return 301 https://<%= @fqdn %>:<%= @port %>$request_uri;
... ... @@ -29,7 +29,7 @@ server {
29 29 <% end %>
30 30  
31 31 server {
32   - listen *:<%= @port %>;
  32 + listen <%= @listen_address %>:<%= @port %>;
33 33 server_name <%= @fqdn %>;
34 34 server_tokens off; # don't show the version number, a security best practice
35 35 root /opt/gitlab/embedded/service/gitlab-rails/public;
... ...