I migrated my Gitlab to a new domain. I'd like to redirect all HTTP requests from the old URL to the new one. Both domains currently point to the same server (using A
DNS records).
I use Gitlab Omnibus package, with the bundled nginx install. How to do this?
First, create /etc/nginx/conf.d/redirect.conf
:
server {
listen 80;
server_name old-gitlab.mydomain.com;
rewrite ^/(.*)$ http://new-gitlab.mydomain.com/$1 permanent;
}
(if the /etc/nginx/conf.d/
path does not exist, go ahead and create it)
Now edit the configuration file at /etc/gitlab/gitlab.rb
to add the following line:
nginx['custom_nginx_config'] = "include /etc/nginx/conf.d/redirect.conf;"
Finally, run gitlab-ctl reconfigure
to rewrite the nginx configuration and restart nginx.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With