502 Error Setup Omnibus Gitlab with Unbundled Nginx

I tried to setup the Gitlab with Unbundled Nginx following by few tutorials. However, after restarting the nginx and reconfigure the gitlab-clt, when opening the site, the 502 error arose. I checked both error_log and access_log. Well, there is nothing in the error_log. The only message in the access_log is like the one below:

172.104.***.*** - - [23/Dec/2017:10:50:05 -0500] "GET / HTTP/1.1" 502 2916 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36"

My nginx config is followed by this sample, below is what I have which is identical:

upstream gitlab-workhorse {
    server unix:/var/opt/gitlab/gitlab-workhorse/socket;

server {
  listen 80;
  listen [::]:80;
  server_name git.domain.com;
  server_tokens off;
  root /opt/gitlab/embedded/service/gitlab-rails/public;

  access_log  /var/log/nginx/gitlab_access.log;
  error_log   /var/log/nginx/gitlab_error.log;

  location / {
    client_max_body_size 0;
    gzip off;

    proxy_read_timeout      300;
    proxy_connect_timeout   300;
    proxy_redirect          off;

    proxy_http_version 1.1;

    proxy_set_header    Host                $http_host;
    proxy_set_header    X-Real-IP           $remote_addr;
    proxy_set_header    X-Forwarded-For     $proxy_add_x_forwarded_for;
    proxy_set_header    X-Forwarded-Proto   $scheme;

    proxy_pass http://gitlab-workhorse;

For /etc/gitlab/gitlab.rb, the code is as below:

web_server['external_users'] = ['www-data']
nginx['enable'] = false

I do not think the problem is related to the permission. The dist that I am using is Debian 9. Following by this guide, I installed ruby and passenger. I have stuck with this 502 error for 2 days, really appriciate with some help!


Try changing your upstream socket to the following.

upstream gitlab-workhorse {
    server unix:/var/opt/gitlab/gitlab-rails/sockets/gitlab.socket;

That should fix it.