企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# GitLab Pages > 原文:[https://docs.gitlab.com/ee/user/project/pages/#getting-started](https://docs.gitlab.com/ee/user/project/pages/#getting-started) * [Getting started](#getting-started) * [How it works](#how-it-works) * [Access to your Pages site](#access-to-your-pages-site) * [Pages examples](#pages-examples) * [Administer GitLab Pages for self-managed instances](#administer-gitlab-pages-for-self-managed-instances) # GitLab Pages[](#gitlab-pages "Permalink") 版本历史 * 在 GitLab 企业版 8.3 中[引入](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/80) . * GitLab 企业版 8.5 中[引入](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/173)了具有 TLS 支持的自定义 CNAME. * [移植](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/14605)到 GitLab 8.17 中的 GitLab 社区版. * 在 GitLab 11.8 中[引入](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/30548)了对子组项目网站的支持. * 捆绑的项目模板在 GitLab 11.8 中[引入](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/47857) . 借助 GitLab 页面,您可以直接从 GitLab 中的存储库发布静态网站. * 用于任何个人或企业网站. * 使用任何静态站点生成器(SSG)或纯 HTML. * 为您的项目,组或用户帐户创建网站. * 免费在自己的 GitLab 实例或 GitLab.com 上托管您的网站. * 连接您的自定义域和 TLS 证书. * 将任何许可归于您的内容. ![Examples of SSGs supported by Pages](https://img.kancloud.cn/60/b9/60b9bf04efe42919d2f712c5807c8d16_600x280.png) 要发布包含 Pages 的网站,您可以使用任何 SSG,例如 Gatsby,Jekyll,Hugo,Middleman,Harp,Hexo 和 Brunch 等. 您还可以发布直接用纯 HTML,CSS 和 JavaScript 编写的任何网站. 网页**不**支持动态服务器端的处理,例如,作为`.php`和`.asp`需要. 了解更多有关[静态网站和动态网站的信息](https://about.gitlab.com/blog/2016/06/03/ssg-overview-gitlab-pages-part-1-dynamic-x-static/) . ## Getting started[](#getting-started "Permalink") 要创建一个 GitLab Pages 网站: | Document | Description | | --- | --- | | [Fork a sample project](getting_started/pages_forked_sample_project.html) | 通过分叉示例项目,使用已配置的 Pages 创建一个新项目. | | [Use a new project template](getting_started/pages_new_project_template.html) | 使用已经使用新项目模板配置的 Pages 创建一个新项目. | | [Use a `.gitlab-ci.yml` template](getting_started/pages_ci_cd_template.html) | 将 Pages 网站添加到现有项目. 使用预填充的 CI 模板文件. | | [Create a `gitlab-ci.yml` file from scratch](getting_started/pages_from_scratch.html) | 将 Pages 网站添加到现有项目. 了解如何创建和配置自己的 CI 文件. | 要更新 GitLab Pages 网站: | Document | Description | | --- | --- | | [GitLab Pages domain names, URLs, and base URLs](getting_started_part_one.html) | 了解有关 GitLab Pages 默认域的信息. | | [Explore GitLab Pages](introduction.html) | 要求,技术方面,特定的 GitLab CI / CD 配置选项,访问控制,自定义 404 页面,限制,常见问题解答. | | [Custom domains and SSL/TLS Certificates](custom_domains_ssl_tls_certification/index.html) | 自定义域和子域,DNS 记录和 SSL / TLS 证书. | | [Let’s Encrypt integration](custom_domains_ssl_tls_certification/lets_encrypt_integration.html) | 使用 Let's Encrypt 证书保护您的 Pages 网站,该证书由 GitLab 自动获取并更新. | | [CloudFlare certificates](https://about.gitlab.com/blog/2017/02/07/setting-up-gitlab-pages-with-cloudflare-certificates/) | 使用 CloudFlare 证书保护您的 Pages 网站. | 了解更多信息并查看示例: | Document | Description | | --- | --- | | [Static vs dynamic websites](https://about.gitlab.com/blog/2016/06/03/ssg-overview-gitlab-pages-part-1-dynamic-x-static/) | 静态与动态网站概述. | | [Modern static site generators](https://about.gitlab.com/blog/2016/06/10/ssg-overview-gitlab-pages-part-2/) | SSG 概述. | | [Build any SSG site with GitLab Pages](https://about.gitlab.com/blog/2016/06/17/ssg-overview-gitlab-pages-part-3-examples-ci/) | 对 GitLab 页面使用 SSG. | ## How it works[](#how-it-works "Permalink") 要使用 GitLab 页面,您必须在 GitLab 中创建一个项目以将您网站的文件上传到该项目. 这些项目可以是公共的,内部的或私人的. GitLab 始终从资源库中一个非常特定的文件夹`public`部署您的网站. 在 GitLab 中创建新项目时, [存储库](../repository/index.html)将自动可用. 为了部署您的站点,GitLab 使用其内置工具[GitLab CI / CD](../../../ci/README.html)来构建您的站点并将其发布到 GitLab Pages 服务器. GitLab CI / CD 运行以完成此任务的脚本序列是从名为`.gitlab-ci.yml`的文件中[创建的](getting_started/pages_from_scratch.html) ,您可以随意[创建和修改](getting_started/pages_from_scratch.html) . 配置文件中称为`pages`的特定`job`会使 GitLab 知道您正在部署 GitLab Pages 网站. 您可以将 GitLab 的[默认域用于](getting_started_part_one.html#gitlab-pages-default-domain-names) `*.gitlab.io` [GitLab Pages 网站](getting_started_part_one.html#gitlab-pages-default-domain-names) `*.gitlab.io` ,也可以使用自己的域( `example.com` ). 在这种情况下,您需要对您域的注册商(或控制面板)具有管理员权限,才能使用 Pages 对其进行设置. 下图显示了开始使用 Pages 可能需要遵循的工作流程. ![New projects for GitLab Pages](https://img.kancloud.cn/59/74/5974318eeb94aebb664f2326051362ff_2517x1957.png) ## Access to your Pages site[](#access-to-your-pages-site "Permalink") 如果您使用的是 GitLab Pages 默认域( `.gitlab.io` ),则您的网站将自动安全并在 HTTPS 下可用. 如果您使用自己的自定义域,则可以选择使用 SSL / TLS 证书对其进行保护. If you’re using GitLab.com, your website will be publicly available to the internet. To restrict access to your website, enable [GitLab Pages Access Control](pages_access_control.html). 如果您使用的是自我管理的实例(Core,Starter,Premium 或 Ultimate),则根据 sysadmin 选择的[Pages admin 设置](../../../administration/pages/index.html) ,您的网站将发布在您自己的服务器上,管理员可以将其设置为公开或内部. ## Pages examples[](#pages-examples "Permalink") 有一些因特定原因而建立的 GitLab Pages 网站的出色示例. 这些示例可以教您使用高级技术并适应您自己的需求: * [Posting to your GitLab Pages blog from iOS](https://about.gitlab.com/blog/2016/08/19/posting-to-your-gitlab-pages-blog-from-ios/). * [GitLab CI: Run jobs sequentially, in parallel, or build a custom pipeline](https://about.gitlab.com/blog/2016/07/29/the-basics-of-gitlab-ci/). * [GitLab CI: Deployment & environments](https://about.gitlab.com/blog/2016/08/26/ci-deployment-and-environments/). * [Building a new GitLab docs site with Nanoc, GitLab CI, and GitLab Pages](https://about.gitlab.com/blog/2016/12/07/building-a-new-gitlab-docs-site-with-nanoc-gitlab-ci-and-gitlab-pages/). * [Publish code coverage reports with GitLab Pages](https://about.gitlab.com/blog/2016/11/03/publish-code-coverage-report-with-gitlab-pages/). ## Administer GitLab Pages for self-managed instances[](#administer-gitlab-pages-for-self-managed-instances "Permalink") 如果您正在运行 GitLab 的自我管理实例(GitLab 社区版和企业版),请[按照管理步骤](../../../administration/pages/index.html)来配置页面. 观看有关如何开始使用 GitLab 页面管理的[视频教程](https://www.youtube.com/watch?v=dD8c7WNcc6s) .