Please help. I have spent days messing with Gitlab and I need a way to add this config into the gitlab-http.conf file. I have been all over the web trying to find out the best way to do this, but nothing really works for our situation. For historic reasons we have a back end that is domain.local, but we are migrating to dev.domain.com. For this reason we need a way for both gitlab.domain.local and gitlab.dev.domain.com to be entered and redirected to the site. I have tried nginx[‘custom_nginx_config’] = but Gitlab won’t take the conf file and I have tried # nginx[‘custom_gitlab_server_config’] =, but this puts the config in the wrong part of the gitlab-http.conf file (at the bottom)
server {
listen 443 ssl;
server_name https://gitlab.domain.local;
ssl_certificate /etc/gitlab/ssl/gitlab.domain.local.crt;
ssl_certificate_key /etc/gitlab/ssl/gitlab.domain.local.key;
rewrite ^/(.*)$ https://gitlab.dev.domain.com/$1 permanent;
}
So that is what I need added and it only works when placed in between the redirect http to https and the rest of the config like below.
## Redirects all HTTP traffic to the HTTPS host
server {
listen *:80;
server_name gitlab.dev.domain.com;
server_tokens off; ## Don't show the nginx version number, a security best practice
return 301 https://gitlab01.dev.armus.com:443$request_uri;
access_log /var/log/gitlab/nginx/gitlab_access.log gitlab_access;
error_log /var/log/gitlab/nginx/gitlab_error.log;
}
## -------------I need the redirect to be here--------
server {
listen 443 ssl;
server_name https://gitlab.domain.local;
ssl_certificate /etc/gitlab/ssl/gitlab.domain.local.crt;
ssl_certificate_key /etc/gitlab/ssl/gitlab.domain.local.key;
rewrite ^/(.*)$ https://gitlab.dev.domain.com/$1 permanent;
}
server {
listen *:443 ssl http2;
I have seen a few people talk about manually adding it and then whenever they run gitlab-ctl reconfigure having to re-add it, but is there a better solution to include it in /etc/gitlab/gitlab.rb?
Looking forward to hearing what you might have to offer.