12

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 ?
Édouard Lopez
  • 425
  • 1
  • 3
  • 13

4 Answers4

10

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
Édouard Lopez
  • 425
  • 1
  • 3
  • 13
  • I̶ ̶w̶o̶u̶l̶d̶ ̶m̶a̶r̶k̶ ̶t̶h̶i̶s̶ ̶a̶s̶ ̶t̶h̶e̶ ̶a̶n̶s̶w̶e̶r̶.̶ ̶I̶t̶ ̶w̶o̶r̶k̶s̶ ̶a̶s̶ ̶f̶a̶r̶ ̶a̶s̶ ̶I̶ ̶c̶a̶n̶ ̶t̶e̶l̶l̶,̶ ̶a̶n̶d̶ ̶t̶h̶e̶r̶e̶ ̶i̶s̶ ̶n̶o̶ ̶b̶e̶t̶t̶e̶r̶ ̶p̶r̶a̶c̶t̶i̶c̶e̶/̶s̶o̶l̶u̶t̶i̶o̶n̶ Gives 404 errors even at login. Is it a mistake on my end? – GCon Jun 08 '15 at 11:25
  • 1
    Yes, it was a mistake on my end. Works! – GCon Jun 10 '15 at 10:41
  • 1
    Note, this no longer works completely, as you'll get a `unknown log format "gitlab_access" in /etc/nginx/sites-enabled/gitlab-http.conf:52` error. – 00500005 Mar 14 '16 at 00:00
  • The following fixes the log format problem `sudo ln -s /var/opt/gitlab/nginx/conf/nginx.conf /etc/nginx/sites-available/` and `sudo ln -s /etc/nginx/sites-{available,enabled}/nginx.conf` – solidgumby May 06 '16 at 04:52
2

As for gitlab 8, we cannot symlink to the default gitlab-http.conf anymore because the bundle webserver will not be installed when we set nginx['enable'] = false.

Just download the right web server configs from GitLab recipes repository and change YOUR_SERVER_FQDN with your preferred domain name.

See here for detail instructions on how to install gitlab using non-bundled web-server.

1

To ensure that user are accessible your Nginx user (usually www-data or nginx) should be added to the gitlab-www group:

sudo usermod -aG gitlab-www nginx

or

sudo usermod -aG gitlab-www www-data
1

If you symlinked gitlab-http.conf and then got :

unknown log format "gitlab_access" in /etc/nginx/sites-enabled/gitlab-http.conf

Just add the log_format directives from /var/opt/gitlab/nginx/conf/nginx.conf to your global nginx configuration :

http {
  ...
  log_format gitlab_access '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent"';
  log_format gitlab_ci_access '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent"';
  log_format gitlab_mattermost_access '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent"';
  ...
}