Gitlab Omnibus: how to redirect all requests to another domain

情到浓时终转凉″ 提交于 2019-12-12 12:29:05

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/33601173/gitlab-omnibus-how-to-redirect-all-requests-to-another-domain

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!