Gitlab Omnibus:如何将所有请求重定向到另一个域

编程入门 行业动态 更新时间:2024-10-27 07:25:10
本文介绍了Gitlab Omnibus:如何将所有请求重定向到另一个域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我将自己的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:如何将所有请求重定向到另一个域

本文发布于:2023-10-31 17:26:37,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1546770.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何将   重定向   Gitlab   Omnibus

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!