Gitlab Omnibus:如何将所有请求重定向到另一个域
Gitlab Omnibus: how to redirect all requests to another domain
我将我的 Gitlab 迁移到了一个新域。我想将所有 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/ 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
我将我的 Gitlab 迁移到了一个新域。我想将所有 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/ 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