Gitlab and Nginx as a reverse proxy

Hi,

I’ve setup an gitlab server on one of my internal server and I have an nginx server on another server. I’m trying to proxy reversing but it just doesn’t work. Here are my settings:

Nginx
location /gitlab/ {
auth_pam off;
access_log /var/log/nginx/gitlab.access.log;
error_log /var/log/nginx/gitlab.error.log;
## If you use https make sure you disable gzip compression
## to be safe against BREACH attack.
#gzip off;
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_redirect off;

    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   https;
    proxy_set_header        X-Frame-Options     SAMEORIGIN;
    proxy_pass https://192.168.0.176/;
}

Gitlab external_url: https://192.168.0.176

When I access Gitlab internally, it works with no problem but when I try to access it externally, I get 404 not found error.

I forgot to mention one thing. When I try to access it through Nginx reverse proxy, and according to the setting shown above, the URL I use is: https://example.com/gitlab but this URL changes to https://example.com/users/sign_in.
Can you please point me to the right direction?

I am facing the same issue and need a solution to this.
How can I redirect Nginx through reverse proxy.

Here is my Nginx config:

location /gitlab/ {
auth_pam off;
access_log /var/log/nginx/gitlab.access.log;
error_log /var/log/nginx/gitlab.error.log;
## If you use https make sure you disable gzip compression
## to be safe against BREACH attack.
#gzip off;
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_redirect off;
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 https;
proxy_set_header X-Frame-Options SAMEORIGIN;
proxy_pass https://192.168.0.176/gitlab/;
client_max_body_size 0;
}
In /etc/gitlab/gitlab.rb:
external_url ‘https://yourdomain/gitlab

Note that the “gitlab” part in the address you set in the Nginx should match the “gitlab” in the external_url. That is, use the same name in both.

That should work:).