I try to setup Nginx Proxy Monitor(NGPM) as a reverse proxy for Gitlab and other websites/services. Gitlab itself is running inside a docker container that has it’s own IP address. NGPM is also inside a docker container. Both containers run on an Unraid server (and were installed from the “Apps” which, in this case are prefilled docker templates)
I’ve tried this:
But this just lead to a
502 Bad Gatewayerror from Nginx.
Also tried some other things, but most links I find talk about decoupling the nginx from gitlab with an nginx on the same machine pointing to some gitlab stuff.
At this point I am lost to why nothing works, and am just poking around in config files without really knowing what I am doing. I don’t even know what to provide you with in order to help me, so please, if you need sth. to help me with my problem I’ll gladly attach that.
Error log looks like this:
2020/06/24 11:55:54 [error] 2834#2834: *1966 connect() failed (113: Host is unreachable) while connecting to upstream, client: 0.0.0.0, server: develop.company.com, request: "GET / HTTP/2.0", upstream: "http://192.168.10.170:80/", host: "develop.company.com", referrer: "http://192.168.10.135:7818/nginx/proxy"
Access Log like this:
[24/Jun/2020:11:49:56 +0200] - 502 502 - GET https develop.company.com "/" [Client 0.0.0.0] [Length 166] [Gzip -] [Sent-to 192.168.10.170] "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:77.0) Gecko/20100101 Firefox/77.0" "http://192.168.10.135:7818/nginx/proxy" [24/Jun/2020:11:49:56 +0200] - - 499 - GET https develop.company.com "/favicon.ico" [Client 0.0.0.0] [Length 0] [Gzip -] [Sent-to 192.168.10.170] "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:77.0) Gecko/20100101 Firefox/77.0" "-"
Note that I changed the client IP for the purpose of uploading here. Since I’m testing it from within the network where proxy and gitlab are located, this is our external IP.
I tried only with this:
But also this:
nginx['listen_port'] = 80
nginx['listen_https'] = false
I also tried the http variant for
Bridging the network connection for the docker container in Unraid, instead of giving it it’s own IP address, did the trick, the reverse proxy seems to work fine now.
Here all the “Setup” that I needed.
In the gitlab.rb file you need to uncomment/set these values:
external_url="https://develop.company.com nginx['listen_port'] = 80 nginx['listen_https'] = false
Note, that the
https:// is necessary here.
So yeah. Don’t know why this didn’t work when Gitlab had it’s own IP address, but this works as expected now.