Skip to main content

Configuring the hostname for your instance

You can provide reliable access to 你的 GitHub Enterprise Server 实例 by assigning a hostname that's accessible over your network.

About the hostname for GitHub Enterprise Server

To provide reliable access to 你的 GitHub Enterprise Server 实例 via a known name on the network, you can configure a hostname. If you configure a hostname instead of using a hard-coded IP address, you will be able to change the physical hardware that 你的 GitHub Enterprise Server 实例 runs on without affecting users or client software.

The hostname setting in the 管理控制台 should be set to an appropriate fully qualified domain name (FQDN) which is resolvable on the internet or within your internal network. For example, your hostname setting could be github.companyname.com. Web and API requests will automatically redirect to the hostname configured in the 管理控制台. Note that localhost is not a valid hostname setting.

Hostnames must be less than 63 characters in length per Section 2.3.4 of the Domain Names Specification RFC.

After you configure a hostname, you can enable subdomain isolation to further increase the security of 你的 GitHub Enterprise Server 实例. For more information, see "Enabling subdomain isolation."

GitHub strongly recommends that you do not change the hostname for an existing GitHub Enterprise Server instance. Changing the hostname will cause unexpected behavior, up to and including instance outages. Instead, configure a new instance with the desired hostname, and then restore settings and data from the original instance to the new instance.

For more information on the supported hostname types, see Section 2.1 of the HTTP RFC.

Configuring the hostname

  1. 在 GitHub Enterprise Server 上的管理帐户中,在任一页面的右上角,单击

  2. 如果你尚未在“站点管理员”页上,请在左上角单击“站点管理员”。

  3. 在“ 站点管理”边栏中,单击“管理控制台”。

  4. 在“设置”边栏中,单击“主机名”。

  5. Under "Hostname", type the hostname you'd like to set for 你的 GitHub Enterprise Server 实例.

  6. To test the DNS and SSL settings for the new hostname, click Test domain settings.

  7. 如果在所有条目旁边没有看到绿色的复选标记,请检查配置,查找失效的设置。 有关详细信息,请参阅“Configuring DNS nameservers”。

  8. 在“设置”边栏下,单击“保存设置”。

    注意:保存 管理控制台 中的设置会重启系统服务,这可能会导致用户可察觉的停机时间。

  9. 等待配置运行完毕。

To help mitigate various cross-site scripting vulnerabilities, we recommend that you enable subdomain isolation for 你的 GitHub Enterprise Server 实例 after you configure a hostname. For more information, see "Enabling subdomain isolation."

Changing the hostname

If you need to change the hostname for 你的 GitHub Enterprise Server 实例, you must restore a backup of your existing instance to a new instance with the desired hostname. For more information, see "Changing the hostname for your instance."

警告:初始设置后不要更改 GitHub Enterprise Server 的主机名。 更改主机名将会导致意外的行为,甚至包括实例中断和用户安全密钥失效。 如果更改了实例的主机名并遇到问题,请联系GitHub Enterprise 支持或GitHub 高级支持。