<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # Custom domains and SSL/TLS Certificates > 原文:[https://docs.gitlab.com/ee/user/project/pages/custom_domains_ssl_tls_certification/](https://docs.gitlab.com/ee/user/project/pages/custom_domains_ssl_tls_certification/) * [Set up Pages with a custom domain](#set-up-pages-with-a-custom-domain) * [Requirements](#requirements) * [Steps](#steps) * [1\. Add a custom domain to Pages](#1-add-a-custom-domain-to-pages) * [2\. Get the verification code](#2-get-the-verification-code) * [3\. Set up DNS records for Pages](#3-set-up-dns-records-for-pages) * [For root domains](#for-root-domains) * [For subdomains](#for-subdomains) * [For both root and subdomains](#for-both-root-and-subdomains) * [4\. Verify the domain’s ownership](#4-verify-the-domains-ownership) * [Troubleshooting Pages domain verification](#troubleshooting-pages-domain-verification) * [Adding more domain aliases](#adding-more-domain-aliases) * [Redirecting `www.domain.com` to `domain.com` with Cloudflare](#redirecting-wwwdomaincom-to-domaincom-with-cloudflare) * [Adding an SSL/TLS certificate to Pages](#adding-an-ssltls-certificate-to-pages) * [Requirements](#requirements-1) * [Steps](#steps-1) * [Force HTTPS for GitLab Pages websites](#force-https-for-gitlab-pages-websites) # Custom domains and SSL/TLS Certificates[](#custom-domains-and-ssltls-certificates "Permalink") 使用自定義域設置 GitLab 頁面,并向其中添加 SSL / TLS 證書,是 GitLab 頁面的可選功能. 要將一個或多個自定義域名用于您的 Pages 網站,您可以: * 添加[自定義**根域**或**子域**](#set-up-pages-with-a-custom-domain) . * Add [SSL/TLS certification](#adding-an-ssltls-certificate-to-pages). ## Set up Pages with a custom domain[](#set-up-pages-with-a-custom-domain "Permalink") 要使用自定義域名設置頁面,請閱讀以下要求和步驟. ### Requirements[](#requirements "Permalink") * 在默認的 Pages 域( `*.gitlab.io` ,對于 GitLab.com)下運行的 GitLab Pages 網站已啟動并正在運行. * 自定義域名`example.com`或子`subdomain.example.com` . * 訪問您域的服務器控制面板以設置 DNS 記錄: * 將您的域指向 GitLab Pages 服務器的 DNS A 或 CNAME 記錄. * DNS TXT 記錄以驗證您的域的所有權. ### Steps[](#steps "Permalink") 請按照以下步驟將您的自定義域添加到 Pages. 另請參閱本文檔,以獲取[有關 DNS 記錄](dns_concepts.html)的[概述](dns_concepts.html) . #### 1\. Add a custom domain to Pages[](#1-add-a-custom-domain-to-pages "Permalink") 導航到項目的" **設置">"頁面"** ,然后單擊" **+新域"**將自定義域添加到 GitLab 頁面. 您可以選擇是否: * Add an [SSL/TLS certificate](#adding-an-ssltls-certificate-to-pages). * 保留為空白(以后可以添加). Click **建立新網域**. [![Add new domain](https://img.kancloud.cn/77/ff/77ffe2029b7244192b15c05881aa1d08_1707x631.png)](img/add_certificate_to_pages.png) #### 2\. Get the verification code[](#2-get-the-verification-code "Permalink") 將新域添加到 Pages 后,系統將提示您輸入驗證碼. 從 GitLab 復制值,并將其作為下一步的 TXT 記錄粘貼到您域的控制面板中. [![Get the verification code](https://img.kancloud.cn/41/3e/413e69bf9abec9ead71e19b936f612b4_2516x1036.png)](img/get_domain_verification_code_v12_0.png) #### 3\. Set up DNS records for Pages[](#3-set-up-dns-records-for-pages "Permalink") 閱讀本文檔以[獲取 Pages 的 DNS 記錄概述](dns_concepts.html) . 如果您熟悉此主題,請根據您要與 Pages 網站一起使用的域類型,按照以下說明進行操作: * [For root domains](#for-root-domains), `example.com`. * [For subdomains](#for-subdomains), `subdomain.example.com`. * [For both](#for-both-root-and-subdomains). **注意:**您可以[在自管實例上配置 IPv6](../../../../administration/pages/index.html#advanced-configuration) ,但是 GitLab.com 上的 Pages 當前未配置 IPv6\. 有關詳細信息,請關注[此問題](https://gitlab.com/gitlab-org/gitlab/-/issues/214718) . ##### For root domains[](#for-root-domains "Permalink") 根域( `example.com` )要求: * 指向您的域指向 Pages 服務器的[DNS A 記錄](dns_concepts.html#a-record) . * [TXT 記錄](dns_concepts.html#txt-record)以驗證您的域的所有權. | From | DNS 記錄 | To | | --- | --- | --- | | `example.com` | A | `35.185.44.232` | | `_gitlab-pages-verification-code.example.com` | TXT | `gitlab-pages-verification-code=00112233445566778899aabbccddeeff` | 對于 GitLab.com 上的項目,此 IP 為`35.185.44.232` . 對于位于其他 GitLab 實例(CE 或 EE)中的項目,請聯系您的系統管理員以詢問此信息(該 IP 地址是實例上運行的 Pages 服務器). [![DNS A record pointing to GitLab.com Pages server](https://img.kancloud.cn/e8/cf/e8cfe8d225e2ffe9d8a6ee4dd8877013_856x84.png)](img/dns_add_new_a_record_example_updated_2018.png) **注意:**請注意,如果**僅**將根域用于 GitLab Pages 網站,并且域注冊商支持此功能,則可以添加 DNS 頂點`CNAME`記錄而不是`A`記錄. 這樣做的主要優點是,當 GitLab.com 上的 GitLab Pages IP 出于任何原因更改時,您無需更新`A`記錄. 可能會有一些例外,但是**不建議使用此方法,**因為如果您為根域設置[`MX`記錄](dns_concepts.html#mx-record) ,則**該方法**很可能不起作用. ##### For subdomains[](#for-subdomains "Permalink") 子域( `subdomain.example.com` )要求: * 將您的子域指向 Pages 服務器的 DNS [CNAME 記錄](dns_concepts.html#cname-record)記錄. * DNS [TXT 記錄](dns_concepts.html#txt-record)以驗證您的域的所有權. | From | DNS 記錄 | To | | --- | --- | --- | | `subdomain.example.com` | CNAME | `namespace.gitlab.io` | | `_gitlab-pages-verification-code.subdomain.example.com` | TXT | `gitlab-pages-verification-code=00112233445566778899aabbccddeeff` | 請注意,無論是用戶網站還是項目網站, `CNAME`都應指向您的 Pages 域( `namespace.gitlab.io` ),而不包含任何`/project-name` . [![DNS CNAME record pointing to GitLab.com project](https://img.kancloud.cn/3b/5b/3b5b38e59b2da7c715521f3197cf31ff_1195x122.png)](img/dns_cname_record_example.png) ##### For both root and subdomains[](#for-both-root-and-subdomains "Permalink") 在某些情況下,您需要將子域和根域都指向同一個網站,例如`example.com`和`www.example.com` . 他們要求: * 域的 DNS A 記錄. * 子域的 DNS CNAME 記錄. * 每個 DNS TXT 記錄. | From | DNS 記錄 | To | | --- | --- | --- | | `example.com` | A | `35.185.44.232` | | `_gitlab-pages-verification-code.example.com` | TXT | `gitlab-pages-verification-code=00112233445566778899aabbccddeeff` | | `www.example.com` | CNAME | `namespace.gitlab.io` | | `_gitlab-pages-verification-code.www.example.com` | TXT | `gitlab-pages-verification-code=00112233445566778899aabbccddeeff` | 如果您使用的是 CloudFlare,請選中[使用 Cloudflare 將`www.domain.com`重定向到`domain.com`](#redirecting-wwwdomaincom-to-domaincom-with-cloudflare) . > **Notes**: > > * 如果要將`domain.com`指向 GitLab Pages 網站,請**不要**使用 CNAME 記錄. 請改用`A`記錄. > * **不要**在默認的 Pages 域之后添加任何特殊字符. 例如,不要將`subdomain.domain.com`指向或`namespace.gitlab.io/` . 但是,某些域托管服務提供商可能會請求結尾點( `namespace.gitlab.io.` ). > * GitLab.com 上的 GitLab Pages IP 在 2017 年[進行了更改](https://about.gitlab.com/releases/2017/03/06/we-are-changing-the-ip-of-gitlab-pages-on-gitlab-com/) . > * GitLab.com [上的](https://about.gitlab.com/blog/2018/07/19/gcp-move-update/#gitlab-pages-and-custom-domains) GitLab Pages IP `35.185.44.232` 2018 年的 52.167.214.135 [更改](https://about.gitlab.com/blog/2018/07/19/gcp-move-update/#gitlab-pages-and-custom-domains)為`52.167.214.135` . #### 4\. Verify the domain’s ownership[](#4-verify-the-domains-ownership "Permalink") 添加所有 DNS 記錄后: 1. 返回項目的**設置>頁面** . 2. 找到您的域名,然后單擊" **詳細信息"** . 3. 點擊**重試驗證**按鈕以激活您的新域. [![Verify your domain](https://img.kancloud.cn/ef/f5/eff5241ff8ba1d2aa210f9d34ab82ef5_2515x1025.png)](img/retry_domain_verification_v12_0.png) 一旦您的域名啟用,您的網站就會通過您的域名可用. **注意:**考慮到啟用了域驗證的 GitLab 實例,如果該域不能在 7 天之內得到驗證,它將被從 GitLab 項目中刪除. > **Notes:** > > * **GitLab.com 用戶必須進行**域驗證; 對于 GitLab 自管實例,您的 GitLab 管理員可以選擇[禁用自定義域驗證](../../../../administration/pages/index.html#custom-domain-verification) . > * [DNS 傳播可能需要一些時間(最多 24 小時)](https://www.inmotionhosting.com/support/domain-names/dns-nameserver-changes/domain-names-dns-changes/) ,盡管通常只需幾分鐘即可完成. 否則,驗證將失敗,并且嘗試訪問您的域的嘗試將以 404 響應. > * 驗證您的域后,請保留驗證記錄:您的域將定期重新驗證,如果刪除該記錄,則可能會被禁用. ##### Troubleshooting Pages domain verification[](#troubleshooting-pages-domain-verification "Permalink") 要手動驗證您已正確配置了域驗證`TXT` DNS 條目,可以在終端中運行以下命令: ``` dig _gitlab-pages-verification-code.<YOUR-PAGES-DOMAIN> TXT ``` 期望輸出: ``` ;; ANSWER SECTION: _gitlab-pages-verification-code.<YOUR-PAGES-DOMAIN>. 300 IN TXT "gitlab-pages-verification-code=<YOUR-VERIFICATION-CODE>" ``` ### Adding more domain aliases[](#adding-more-domain-aliases "Permalink") You can add more than one alias (custom domains and subdomains) to the same project. An alias can be understood as having many doors leading to the same room. 您為網站設置的所有別名都將在" **設置">"頁面"**上列出. 在該頁面上,您可以查看,添加和刪除它們. ### Redirecting `www.domain.com` to `domain.com` with Cloudflare[](#redirecting-wwwdomaincom-to-domaincom-with-cloudflare "Permalink") 如果您使用 Cloudflare,則可以將`www`重定向到`domain.com`而無需同時將`www.domain.com`和`domain.com`添加到 GitLab. 為此,您可以使用與 CNAME 記錄關聯的 Cloudflare 的頁面規則將`www.domain.com`重定向到`domain.com` . 您可以使用以下設置: 1. 在 Cloudflare 中,創建一個 DNS `A`記錄,將`domain.com`指向`35.185.44.232` . 2. 在 GitLab 中,將域添加到 GitLab 頁面中并獲取驗證碼. 3. 在 Cloudflare 中,創建 DNS `TXT`記錄以驗證您的域. 4. 在 GitLab 中,驗證您的域. 5. 在 Cloudflare 中,創建將`www`指向`domain.com`的 DNS `CNAME`記錄. 6. 在 Cloudflare 中,添加將`www.domain.com`指向`domain.com`的頁面規則: * 導航到您域的信息中心,然后點擊頂部導航欄中的**頁面規則** . * 單擊**創建頁面規則** . * 輸入域名`www.domain.com` ,然后點擊**+添加設置** . * 從下拉菜單中,選擇**轉發 URL** ,然后選擇狀態代碼**301-永久重定向** . * 輸入目標網址`https://domain.com` . ## Adding an SSL/TLS certificate to Pages[](#adding-an-ssltls-certificate-to-pages "Permalink") 閱讀本文檔以獲取[有關 SSL / TLS 認證](ssl_tls_concepts.html)的[概述](ssl_tls_concepts.html) . 要使用 GitLab 頁面保護您的自定義域,您可以選擇: * 使用[Let's Encrypt 與 GitLab Pages 的集成](lets_encrypt_integration.html) ,該[集成](lets_encrypt_integration.html)會自動獲取和續訂您 Pages 域的 SSL 證書. * 遵循以下步驟,將 SSL / TLS 證書手動添加到 GitLab Pages 網站. ### Requirements[](#requirements-1 "Permalink") * 可通過自定義域訪問 GitLab Pages 網站并正在運行. * **PEM 證書** :它是由 CA 生成的證書,需要將其添加到字段**Certificate(PEM)中** . * **[中間證書](https://en.wikipedia.org/wiki/Intermediate_certificate_authority)** :(也稱為"根證書"),它是標識 CA 的加密密鑰鏈的一部分. 通常,它與 PEM 證書結合在一起,但是在某些情況下,您需要手動添加它們. [CloudFlare 證書](https://about.gitlab.com/blog/2017/02/07/setting-up-gitlab-pages-with-cloudflare-certificates/)就是其中一種. * **私鑰** ,這是一個加密密鑰,可根據您的域驗證您的 PEM. ### Steps[](#steps-1 "Permalink") * 要在添加新域時添加證書,請轉至項目的**"設置">"頁面">"新域"** ,添加域名和證書. * 要將證書添加到先前添加的域中,請轉到項目的**"設置">"頁面"** ,找到您的域名,單擊" **詳細信息"**和" **編輯"**以添加證書. [![Pages project - adding certificates](https://img.kancloud.cn/77/ff/77ffe2029b7244192b15c05881aa1d08_1707x631.png)](img/add_certificate_to_pages.png) 1. 將 PEM 證書添加到其相應的字段. 2. 如果您的證書缺少中間證書,請復制并粘貼根證書(通常可從您的 CA 網站獲得),然后將其粘貼到[與 PEM 證書相同的字段中](https://about.gitlab.com/blog/2017/02/07/setting-up-gitlab-pages-with-cloudflare-certificates/) ,只需在它們之間跳過一行即可. 3. 復制您的私鑰并將其粘貼到最后一個字段中. **注意:** **請勿**在常規文本編輯器中打開證書或加密密鑰. 始終使用代碼編輯器(例如 Sublime Text,Atom,Dreamweaver,括號等). ## Force HTTPS for GitLab Pages websites[](#force-https-for-gitlab-pages-websites "Permalink") 在 GitLab 10.7 中[引入](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/28857) . 為了使您的網站訪問者更加安全,您可以選擇對 GitLab 頁面強制使用 HTTPS. 這樣,所有通過 HTTP 訪問您的網站的嘗試都會通過 301 自動重定向到 HTTPS. 它既可以與 GitLab 的默認域一起使用,也可以與您的自定義域一起使用(只要您為其設置了有效的證書). 要啟用此設置: 1. 導航到項目的**"設置">"頁面"** . 2. 選中" **強制 HTTPS** "復選框**(需要有效的證書)** . **注意:**如果在 GitLab 頁面前面使用 CloudFlare CDN,請確保將 SSL 連接設置設置為`full`而不是`flexible` . 有關更多詳細信息,請參閱[CloudFlare CDN 指導](https://support.cloudflare.com/hc/en-us/articles/200170416-End-to-end-HTTPS-with-Cloudflare-Part-3-SSL-options#h_4e0d1a7c-eb71-4204-9e22-9d3ef9ef7fef) .
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看