我将自己的Gitlab迁移到了新域.我想将所有HTTP请求从旧的URL重定向到新的URL.当前两个域都指向同一台服务器(使用A DNS记录).
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).
我将Gitlab Omnibus软件包与捆绑的nginx安装一起使用. 该怎么做?
I use Gitlab Omnibus package, with the bundled nginx install. How to do this?
推荐答案首先,创建/etc/nginx/conf.d/redirect.conf:
server { listen 80; server_name old-gitlab.mydomain; rewrite ^/(.*)$ new-gitlab.mydomain/$1 permanent; }(如果/etc/nginx/conf.d/路径不存在,请继续创建它)
(if the /etc/nginx/conf.d/ path does not exist, go ahead and create it)
现在在/etc/gitlab/gitlab.rb处编辑配置文件以添加以下行:
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;"最后,运行gitlab-ctl reconfigure重写nginx配置并重新启动nginx.
Finally, run gitlab-ctl reconfigure to rewrite the nginx configuration and restart nginx.
更多推荐
Gitlab Omnibus:如何将所有请求重定向到另一个域
发布评论