How to secure multiple domain names with TLS on a single GitLab server

What I already have

I have a GitLab CE instance running on a server with a domain name that I want: let’s call it I used Let’s Encrypt to fetch a TLS certificate, and edited the gitlab.rb configuration file to add that cert to the nginx.conf file that GitLab generates. All that’s working, that’s not a problem.

What I’m trying to do

That server running the GitLab CE instance is accessible via 2 domains. I know nginx can be configured to serve as a reverse proxy for multiple domains (I’m doing it on another server with some other sites). However, the gitlab.rb configuration file doesn’t seem to make it possible to do this.

I have certs for both domains, I just don’t know how to serve both sites through nginx that gets configured by GitLab.

I could probably edit the /var/opt/gitlab/nginx/conf files to serve the other cert for, but I’m afraid that GitLab will simply wipe out and re-generate the configuration files when it gets reconfigured.

Has anyone tried to do this before successfully? Any tips would be appreciated.

What is the purpose for such a configuration?

Because there are two DNS entries to the same server and, if it’s easy, I’d like the site to be accessible (without TLS errors/warnings) for both domain names.

I don’t control the DNS settings – those are set for me.


Have a look to my answer here just use 2 server{} entries within nginx config with the acc. certificate.

Good luck!