The two following docker containers are running on my machine:
nginx 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp nginx
gitlab/gitlab-ce:latest 0.0.0.0:32782->22/tcp, 0.0.0.0:32781->80/tcp, 0.0.0.0:32780->443/tcp gitlab
At the moment I cannot figure out how to configure nginx to reverse proxy the user request. If a user enters http://gitlab.domain.com my setup returns a 502 Bad Gateway Error.
Server config:
server{
listen 80;
listen [::]:80;
server_name gitlab.domain.com www.gitlab.domain.com;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header HOST $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://gitlab:32781;
proxy_redirect off;
}
}
For me worked following configuration for jwilder/nginx-proxy container.
Tricky part was to figure out how containers is connected and which and who should process SSL.
For this configuration you should supply SSL certificates both for nginx-proxy and gitlab-ce containers, because communications between them is also using SSL. For gitlab-ce use ./data/config/ssl folder.
You can find out in my blog post how to quickly get valid certificate from Let's encrypt via handy docker container certbot.
Here is a working docker-compose.yml:
Using jwilder/nginx-proxy container as Max Prokopov answer. The critical part for my case was VIRTUAL_PORT and VIRTUAL_PROTO environment variables. Don't setting them propretly cause Nginx 400 error: "
The plain HTTP request was sent to HTTPS port
".Here is a spinet for the gitlab part of conf.d/default.conf nginx file:
you don't need to map gitlab container ports to host port because nginx container knows other container, and try
You have to link the container before into run command of nginx container