Gitlab Omnibus:如何将所有请求重定向到另一个域
作者:互联网
我将Gitlab迁移到了一个新域.我想将旧URL中的所有HTTP请求重定向到新URL.两个域当前都指向同一服务器(使用A DNS记录).
我使用Gitlab Omnibus包,与捆绑的nginx安装.
这该怎么做?
解决方法:
首先,创建/etc/nginx/conf.d/redirect.conf:
server {
listen 80;
server_name old-gitlab.mydomain.com;
rewrite ^/(.*)$http://new-gitlab.mydomain.com/$1 permanent;
}
(如果/etc/nginx/conf.d/路径不存在,请继续创建它)
现在编辑/etc/gitlab/gitlab.rb中的配置文件以添加以下行:
nginx['custom_nginx_config'] = "include /etc/nginx/conf.d/redirect.conf;"
最后,运行gitlab-ctl reconfigure重写nginx配置并重启nginx.
标签:nginx,gitlab,redirect,gitlab-omnibus 来源: https://codeday.me/bug/20190724/1526510.html