<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國際加速解決方案。 廣告
                # Exploring GitLab Pages > 原文:[https://docs.gitlab.com/ee/user/project/pages/introduction.html](https://docs.gitlab.com/ee/user/project/pages/introduction.html) * [GitLab Pages requirements](#gitlab-pages-requirements) * [GitLab Pages on GitLab.com](#gitlab-pages-on-gitlabcom) * [Example projects](#example-projects) * [Custom error codes Pages](#custom-error-codes-pages) * [Redirects in GitLab Pages](#redirects-in-gitlab-pages) * [GitLab Pages Access Control](#gitlab-pages-access-control-core) * [Unpublishing your Pages](#unpublishing-your-pages) * [Limitations](#limitations) * [Specific configuration options for Pages](#specific-configuration-options-for-pages) * [`.gitlab-ci.yml` for plain HTML websites](#gitlab-ciyml-for-plain-html-websites) * [`.gitlab-ci.yml` for a static site generator](#gitlab-ciyml-for-a-static-site-generator) * [`.gitlab-ci.yml` for a repository where there’s also actual code](#gitlab-ciyml-for-a-repository-where-theres-also-actual-code) * [Serving compressed assets](#serving-compressed-assets) * [Resolving ambiguous URLs](#resolving-ambiguous-urls) * [Frequently Asked Questions](#frequently-asked-questions) * [Can I download my generated pages?](#can-i-download-my-generated-pages) * [Can I use GitLab Pages if my project is private?](#can-i-use-gitlab-pages-if-my-project-is-private) * [Do I need to create a user/group website before creating a project website?](#do-i-need-to-create-a-usergroup-website-before-creating-a-project-website) * [Known issues](#known-issues) # Exploring GitLab Pages[](#exploring-gitlab-pages "Permalink") 本文檔是用戶指南,用于探索 GitLab Pages 提供的選項和設置. 首先要熟悉 GitLab 頁面: * 閱讀[有關 GitLab Pages](index.html#overview)的[介紹](index.html#overview) . * Learn [how to get started with Pages](index.html#getting-started). * 在[管理員文檔中](../../../administration/pages/index.html)了解如何在整個 GitLab 實例上啟用 GitLab 頁面. ## GitLab Pages requirements[](#gitlab-pages-requirements "Permalink") 簡而言之,這是您需要在 GitLab 頁面中上傳網站的內容: 1. 實例的域:用于 GitLab 頁面的域名(詢問管理員). 2. GitLab CI / CD:一個`.gitlab-ci.yml`文件,在存儲庫的根目錄中有一個名為[`pages`](../../../ci/yaml/README.html#pages)的特定作業. 3. 您網站存儲庫中一個名為`public`的目錄,其中包含要發布的內容. 4. 為項目啟用了 GitLab Runner. ## GitLab Pages on GitLab.com[](#gitlab-pages-on-gitlabcom "Permalink") 如果您使用[GitLab.com](#gitlab-pages-on-gitlabcom)上的[GitLab 頁面](#gitlab-pages-on-gitlabcom)來托管您的網站,則: * The domain name for GitLab Pages on GitLab.com is `gitlab.io`. * 自定義域和 TLS 支持已啟用. * 共享運行器默認情況下處于啟用狀態,免費提供,可用于構建您的網站. 如果您愿意,仍然可以攜帶自己的跑步者. ## Example projects[](#example-projects "Permalink") 訪問[GitLab 頁面組](https://gitlab.com/groups/pages)以獲得示例項目的完整列表. 歡迎捐款. ## Custom error codes Pages[](#custom-error-codes-pages "Permalink") 您可以通過在將包含在工件中的`public/`目錄的根目錄中分別創建`403.html`和`404.html`文件來提供自己的 403 和 404 錯誤頁面. 通常,這是項目的根目錄,但是根據您的靜態生成器配置,它可能有所不同. 如果是`404.html` ,則有不同的方案. 例如: * 如果您使用項目 Pages(在`/projectname/` )并嘗試訪問`/projectname/non/existing_file` ,則 GitLab Pages 將嘗試首先提供`/projectname/404.html` ,然后提供`/404.html` . * 如果您使用用戶/組頁面(在`/`下提供)并嘗試訪問`/non/existing_file` GitLab Pages 將嘗試提供`/404.html` . * 如果您使用自定義域并嘗試訪問`/non/existing_file` ,則 GitLab Pages 將嘗試僅提供`/404.html` . ## Redirects in GitLab Pages[](#redirects-in-gitlab-pages "Permalink") 由于您不能使用任何自定義服務器配置文件(例如`.htaccess`或任何`.conf`文件),因此,如果要將頁面重定向到其他位置,可以使用[HTTP meta refresh 標簽](https://en.wikipedia.org/wiki/Meta_refresh) . 一些靜態網站生成器提供了該功能的插件,因此您不必手動創建和編輯 HTML 文件. 例如,Jekyll 具有[redirect-from 插件](https://github.com/jekyll/jekyll-redirect-from) . ## GitLab Pages Access Control[](#gitlab-pages-access-control-core "Permalink") 要限制對您網站的訪問,請啟用[GitLab 頁面訪問控制](pages_access_control.html) . ## Unpublishing your Pages[](#unpublishing-your-pages "Permalink") 如果您需要清除 Pages 內容,可以通過右上角的齒輪圖標進入項目設置,然后導航至**Pages** . 點擊**刪除頁面**按鈕,您的頁面網站將被刪除. [![Remove pages](https://img.kancloud.cn/85/a2/85a2b51f57c23e7c2c0cba15f9eeea41_2798x442.png)](img/remove_pages.png) ## Limitations[](#limitations "Permalink") 在 GitLab 實例的常規域( `*.example.io` )下使用 Pages 時, *不能*將 HTTPS 與子子域一起使用. 這意味著,如果你的用戶名或組名稱中包含一個圓點,例如`foo.bar` ,域`https://foo.bar.example.io`將*無法*正常工作. 這是[HTTP Over TLS 協議](https://tools.ietf.org/html/rfc2818#section-3.1)的限制. 如果您不將 HTTP 重定向到 HTTPS,HTTP 頁面將繼續工作. GitLab 網頁[**不**支持組為網站分組](../../group/subgroups/index.html#limitations) . 您只能創建最高級別的群組網站. ## Specific configuration options for Pages[](#specific-configuration-options-for-pages "Permalink") 了解如何針對特定用例設置 GitLab CI / CD. ### `.gitlab-ci.yml` for plain HTML websites[](#gitlab-ciyml-for-plain-html-websites "Permalink") 假設您的存儲庫包含以下文件: ``` ├── index.html ├── css │ └── main.css └── js └── main.js ``` 然后,下面的`.gitlab-ci.yml`示例僅將所有文件從項目的根目錄移至`public/`目錄. `.public`解決方法是, `cp`不會在無限循環中將`public/`復制到自身: ``` pages: script: - mkdir .public - cp -r * .public - mv .public public artifacts: paths: - public only: - master ``` ### `.gitlab-ci.yml` for a static site generator[](#gitlab-ciyml-for-a-static-site-generator "Permalink") 請參閱本文檔,以獲取[分步指南](getting_started/pages_from_scratch.html) . ### `.gitlab-ci.yml` for a repository where there’s also actual code[](#gitlab-ciyml-for-a-repository-where-theres-also-actual-code "Permalink") 請記住,默認情況下,GitLab 頁面是分支/標簽不可知的,它們的部署僅取決于您在`.gitlab-ci.yml`指定`.gitlab-ci.yml` . 每當將新的提交推送到專門用于頁面的分支時,就可以使用[`only`參數](../../../ci/yaml/README.html#onlyexcept-basic)限制`pages`作業. 這樣,您可以將項目的代碼保存在`master`分支中,并使用一個孤兒分支(將其命名為`pages` )來托管您的靜態生成器站點. 您可以這樣創建一個新的空分支: ``` git checkout --orphan pages ``` 在這個新分支上進行的第一次提交將沒有父母,這將是與所有其他分支和提交完全脫節的新歷史的根源. 在`pages`分支中推送靜態生成器的源文件. 以下是`.gitlab-ci.yml`的副本,其中最重要的一行是最后一行,指定要執行`pages`分支中的所有`pages` : ``` image: ruby:2.6 pages: script: - gem install jekyll - jekyll build -d public/ artifacts: paths: - public only: - pages ``` 請參見一個示例,該示例在[`master`分支](https://gitlab.com/pages/jekyll-branched/tree/master)中具有不同的文件,而 Jekyll 的源文件在[`pages`分支中](https://gitlab.com/pages/jekyll-branched/tree/pages) ,該[分支](https://gitlab.com/pages/jekyll-branched/tree/pages)還包含`.gitlab-ci.yml` . ### Serving compressed assets[](#serving-compressed-assets "Permalink") 大多數現代的瀏覽器都支持下載壓縮格式的文件. 通過減小文件大小,可以加快下載速度. Pages 將提供未壓縮的文件之前,將檢查是否存在擴展名為`.gz`的相同文件. 如果支持,并且瀏覽器支持接收壓縮文件,它將使用該版本而不是未壓縮版本. 要利用此功能,您上傳到頁面的工件應具有以下結構: ``` public/ ├─┬ index.html │ └ index.html.gz │ ├── css/ │ └─┬ main.css │ └ main.css.gz │ └── js/ └─┬ main.js └ main.js.gz ``` 這可以通過在`.gitlab-ci.yml`頁面作業中包含以下`script:`來實現: ``` pages: # Other directives script: # Build the public/ directory first - find public -type f -regex '.*\.\(htm\|html\|txt\|text\|js\|css\)$' -exec gzip -f -k {} \; ``` 通過預壓縮文件并在工件中包括兩個版本,Pages 可以處理對壓縮和未壓縮內容的請求,而無需按需壓縮文件. ### Resolving ambiguous URLs[](#resolving-ambiguous-urls "Permalink") 在 GitLab 11.8 中[引入](https://gitlab.com/gitlab-org/gitlab-pages/-/issues/95) 當接收到不包含擴展名的 URL 的請求時,GitLab Pages 會假設要提供哪些文件. 考慮使用以下文件部署的 Pages 站點: ``` public/ ├─┬ index.html │ ├ data.html │ └ info.html │ ├── data/ │ └── index.html ├── info/ │ └── details.html └── other/ └── index.html ``` 頁面支持通過幾個不同的 URL 來訪問每個文件. 特別是,如果 URL 僅指定目錄,它將始終尋找`index.html`文件. 如果該 URL 引用了一個不存在的文件,但是將`.html`添加到該 URL 中會導致該文件*確實*存在,將改為提供該文件. 以下是在上述 Pages 網站上發生的情況的一些示例: | URL path | HTTP 響應 | 文件送達 | | --- | --- | --- | | `/` | `200 OK` | `public/index.html` | | `/index.html` | `200 OK` | `public/index.html` | | `/index` | `200 OK` | `public/index.html` | | `/data` | `200 OK` | `public/data/index.html` | | `/data/` | `200 OK` | `public/data/index.html` | | `/data.html` | `200 OK` | `public/data.html` | | `/info` | `200 OK` | `public/info.html` | | `/info/` | `200 OK` | `public/info.html` | | `/info.html` | `200 OK` | `public/info.html` | | `/info/details` | `200 OK` | `public/info/details.html` | | `/info/details.html` | `200 OK` | `public/info/details.html` | | `/other` | `302 Found` | `public/other/index.html` | | `/other/` | `200 OK` | `public/other/index.html` | | `/other/index` | `200 OK` | `public/other/index.html` | | `/other/index.html` | `200 OK` | `public/other/index.html` | **注意:**當存在`public/data/index.html`時,對于`/data`和`/data/` URL 路徑,其優先于`public/data.html`文件. ## Frequently Asked Questions[](#frequently-asked-questions "Permalink") ### Can I download my generated pages?[](#can-i-download-my-generated-pages "Permalink") 當然. 您需要做的就是從作業頁面下載工件存檔. ### Can I use GitLab Pages if my project is private?[](#can-i-use-gitlab-pages-if-my-project-is-private "Permalink") 是. GitLab Pages 不在乎將項目的可見性級別設置為私有,內部還是公共. ### Do I need to create a user/group website before creating a project website?[](#do-i-need-to-create-a-usergroup-website-before-creating-a-project-website "Permalink") 不,你沒有. 您可以先創建您的項目,然后將在`http(s)://namespace.example.io/projectname`下對其進行訪問. ## Known issues[](#known-issues "Permalink") 有關已知問題的列表,請訪問 GitLab 的[公共問題跟蹤器](https://gitlab.com/gitlab-org/gitlab/-/issues?label_name[]=Category:Pages) .
                  <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>

                              哎呀哎呀视频在线观看