带有自定义域的无法访问的gitlab页面 [英] Unreachable gitlab page with custom domain

查看:79
本文介绍了带有自定义域的无法访问的gitlab页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用Hugo创建了一个网站,并将其托管为gitlab页面.

I created a site with Hugo and I hosted it as a gitlab page.

要分配我的自定义域,我按照此文档的说明进行操作.

To assign my custom domain I followed the instructions of this document of gitlab.

我创建了三个DNS记录:

I created three DNS records:

  1. 类型为 A 且名称为 @ 且值为 35.185.44.232 ;
  2. 类型为 TXT 且名称为 @ 且值为 _gitlab-pages-verification ... 的其中之一,用于验证域的所有权;
  3. 类型为 A 且名称为 www 且值为 35.185.44.232 的一个.
  1. one of type A with name @ and value 35.185.44.232;
  2. one of type TXT with name @ and value _gitlab-pages-verification ... for the verification of the ownership of the domain;
  3. one of type A with name www and value 35.185.44.232.

如果我使用地址 https://example.com 访问该网站,则一切正常;但是,如果我使用三元组W( www.example.com )登录,则会从gitlab收到错误消息 401.您无权访问该资源.您尝试访问的资源受到保护,并且您没有查看该资源的必要权限.

If I access the site using the address https://example.com everything works normally; but if I log in using the triple W (www.example.com) I get from gitlab the error message 401 You don't have permission to access the resource. The resource that you are attempting to access is protected and you don't have the necessary permissions to view it.

我该如何纠正?

推荐答案

为您的 WWW尝试 CNAME 而不是第二个 A 记录.子域.有两条 A 记录-一条指向您的裸域,一条指向您的WWW域,这要么导致重定向错误,要么根本不存在,因为它作为源的子域必须以在GitLab OR 上的单独实体,您不必担心,通过使用我以前建议的 CNAME 记录并使用目录样式(而不是子域样式)为您的网站设置.每种方法都有其自身的优点和缺点.我使用 CNAME 方法,并且在GitLab上设置了WWW子域,以便我的网站向安装了TLS证书的访问者授予额外的安全性和隐私权在 WWW-subdomain 优惠中.

Try a CNAME instead of a second A record for your WWW. subdomain. Having two A records - one that points to your naked domain and one that points to your WWW-domain is either causing redirect error or simply does not exist since it, as your origin's subdomain, must exist as a separate entity on GitLab OR you can not concern yourself with it by using a CNAME record as I previously recommended and using a directory-style (as opposed to a subdomain-style) setup for your site. Each has its own benefits as well as drawbacks. I use the CNAME method and have a WWW-subdomain setup on GitLab in order for my sites to grant that extra bit of security and privacy to visitors that having a TLS cert installed on the WWW-subdomain offers.

这篇关于带有自定义域的无法访问的gitlab页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆