V
V
voe2016-06-27 11:03:00
Nginx
voe, 2016-06-27 11:03:00

How to set proxy for Gitlab in nginx?

There is a server on which Nginx is running and provides access to a locally hosted site on Ruby on Rails.
I want to add gitlab to this server (so that it is available at 10.0.0.1/gitlab) which is installed on another server (gitlab is available at http:/ /10.0.0.2) . In the nginx config I write:

location /gitlab {
proxy_pass              http://10.0.0.2/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  }

But when I go to 10.0.0.1/gitlab , it redirects me to the main page of the site.
At the same time, a similar config for piwik works fine.
How to set up correctly?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
TyzhSysAdmin, 2016-06-27
@voe

server_addr_or_ip - change to domain name or IP

upstream gitlab-app {
              least_conn;
              server server_addr_or_ip:80 weight=10 max_fails=3 fail_timeout=30s;
        }

 location /gitlab {
                proxy_pass http://gitlab-app;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection 'upgrade';
                proxy_set_header Host $host;
                proxy_cache_bypass $http_upgrade;
              }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question