Nginx – How to setup Gitlab-omnibus with non-bundled web-server

debian-wheezygitlabnginx

Install

  1. I installed the gitlab package through the omnibus package on debian 7 (version7.8.1-omnibus-1_amd64.deb) ;
  2. change the settings as describe in Using a non-bundled web-server
  3. run the reconfigure command: sudo gitlab-ctl reconfigure (complete without error).

Nginx

I got no nginx' config for this gitlab except for what the package might have created with the following /etc/gitlab/gitlab.rb file:

external_url 'http://git.mydomain.fr'
web_server['external_users'] = ['www-data']
nginx['enable'] = false
ci_nginx['enable'] = false

Logs

/var/log/nginx/gitlab_error.log

2015/02/28 14:29:16 [alert] 4137#0: *14738 768 worker_connections are not enough while connecting to upstream, client: x.x.128.194, server: git.mydomain.fr, request: "GET / HTTP/1.0", upstream
: "http://x.x.128.194:80/", host: "git.mydomain.fr"

/var/log/nginx/gitlab_access.log

In the acces.log I got hundreds of requests on /.

x.x.128.194 - - [28/Feb/2015:14:29:16 +0100] "GET / HTTP/1.0" 500 186 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:37.0) Gecko/20100101 Firefox/37.0"
x.x.128.194 - - [28/Feb/2015:14:29:16 +0100] "GET / HTTP/1.0" 500 186 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:37.0) Gecko/20100101 Firefox/37.0"
x.x.128.194 - - [28/Feb/2015:14:29:16 +0100] "GET / HTTP/1.0" 500 186 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:37.0) Gecko/20100101 Firefox/37.0"x.x.128.194 - - [28/Feb/2015:14:29:16 +0100] "GET / HTTP/1.0" 500 186 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:37.0) Gecko/20100101 Firefox/37.0"
x.x.128.194 - - [28/Feb/2015:14:29:16 +0100] "GET / HTTP/1.0" 500 186 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:37.0) Gecko/20100101 Firefox/37.0"

Question

When trying to contact the serve locally using links2 or externally I got an error 502 Bad Gateway.

  • do I need to create a custom nginx' config ?

Best Answer

Continuing to explore I find the /var/opt/gitlab/ directory and solve this doing:

sudo ln -s /var/opt/gitlab/nginx/conf/gitlab-http.conf /etc/nginx/sites-available/
sudo ln -s /etc/nginx/sites-{available,enabled}/gitlab-http.conf
sudo service nginx reload