SharePoint Server 中已指定主機的網站集合架構與部署Host-named site collection architecture and deployment in SharePoint Server

摘要:規劃和實作 SharePoint 2013 和 SharePoint Server 2016 中已指定主機的網站集合,以及了解路徑型網站集合如何影響您的環境。Summary: Plan and implement host-named site collections in SharePoint 2013 and SharePoint Server 2016 . Learn how path-based site collections might affect your environment.

主機命名型網站集合是在 SharePoint Server 中部署網站較好的方法。因為 Office 365 環境使用主機命名型網站集合,所以新功能已針對這些網站集合進行最佳化,而變得更加可靠。了解如何規劃並實作主機命名型網站集合、設計其 URL,以及管理其 URL。Host-named site collections are the preferred method to deploy sites in SharePoint Server. Because the Office 365 environment uses host-named site collections, new features are optimized for these site collections and they are expected to be more reliable. Learn how to plan for and implement host-named site collections, design URLs, and manage URLs.

主機命名型網站集合的架構與設計Architecture and design for host-named site collections

主機命名型網站集合可讓您指派專屬 DNS 名稱給網站集合。例如,您可以將它們的位址寫成 http://TeamA.contoso.comhttp://TeamB.contoso.com。這可讓您在同一個 Web 應用程式中,部署許多具有專屬 DNS 名稱的網站。它也可讓主控者將環境延伸到許多客戶。如果不使用主機命名型網站集合,SharePoint Web 應用程式將包含許多具有相同主機名稱 (DNS 名稱) 的路徑型網站集合。例如,小組 A 具有位址為 http://contoso.com/sites/teamA 的網站集合,而小組 B 具有位址為 http://contoso.com/sites/teamB 的網站集合。Host-named site collections enable you to assign a unique DNS name to site collections. For example, you can address them as http://TeamA.contoso.com and http://TeamB.contoso.com. This enables you to deploy many sites with unique DNS names in the same web application. It also enables hosters to scale an environment to many customers. If you do not use host-named site collections, your SharePoint web application will contain many path-based site collections that share the same host name (DNS name). For example, Team A has a site collection at http://contoso.com/sites/teamA, and Team B has a site collection at http://contoso.com/sites/teamB.

除非有需求指出必須使用搭配了備用存取對應的路徑型網站 (本文稍後將有相關說明),否則建議使用主機命名型網站集合。本文說明如何以搭配了 SharePoint Server 的建議組態,實作主機命名型網站集合。以下文章的內容最後會有進階組態資訊:<將多個 Web 應用程式與主機命名型網站集合搭配使用>。We recommend host-named site collections unless requirements dictate that path-based sites with alternate access mapping are necessary (described later in this article). This article describes how to implement host-named site collections in a recommended configuration with SharePoint Server. Information about advanced configurations is included at the end of this article: Use multiple web applications with host-named site collections.

建議的網站部署組態是使用主機命名型網站集合,其中所有網站都位於單一 Web 應用程式中,如下圖所示。The recommended configuration for deploying sites is using host-named site collections with all sites located within a single web application, as illustrated in the following diagram.

主機命名型網站集合的建議組態Recommended configuration for host-named site collections

Diagram that shows recommended configuration for host-named site collections

圖中的建議組態包含下列元素:This recommended configuration in the diagram includes the following elements:

  • 一個應用程式集區,用於網站集合。One application pool for site collections.

  • 一個 Web 應用程式,用於一個應用程式集區內裝載的網站集合。One web application for site collections that is hosted inside the one application pool.

  • 一個根網站集合 (http://webapp.contoso.com)。A root site collection (http://webapp.contoso.com).

  • 多個主機命名型網站集合,用以裝載含有範例網站的內容:Multiple host-named site collections to host content with example sites:

    • 發佈的內部網路內容 (http://intranet.contoso.com),具有 HR、廠房和採購部門的子網站。Published intranet content (http://intranet.contoso.com) with subsites for HR, Facilities, and Purchasing.

    • 小組網站 (http://teams.contoso.com),具有小組 1、小組 2 和小組 3 的子網站。Team sites (http://teams.contoso.com) with subsites for Team 1, Team 2, and Team 3.

    • 我的網站,具有下列格式的網站 URL:webapp.contoso.comhttp://my.contoso.com/personal/<site_name>。My Sites with site URLs in the following format: webapp.contoso.comhttp://my.contoso.com/personal/<site_name>.

就此範例而言,Web 應用程式中的網站數目與網站 URL 並不重要。The number of sites within the web application and the URLs for sites are not important for this example.

建立主機命名型網站集合的 Web 應用程式時,Web 應用程式和根網站集合的 URL 將會是 http://< webapp.contoso.com>/。When creating a Web application for host-named site collections, the URL of the Web application and the root site collection will be http://< webapp.contoso.com>/.

URLs of the Web app and root site collection.

建議使用此架構來部署網站,因為其與 Office 365 環境使用的架構相同。因此,這是最常測試的組態。新功能 (包括應用程式模型與要求管理) 已針對此組態最佳化,因此此組態是未來最可靠的設定。This architecture is recommended to deploy sites because it is the same architecture that the Office 365 environment uses. Consequently this is the most heavily tested configuration. New features, including the App model and Request Management, are optimized for this configuration, and it is the most reliable configuration going forward.

建議的組態不包含下列元素:The recommended configuration does not include the following elements:

  • 以多個區域啟用環境中的應用程式。Enabling apps in environments with multiple zones.

  • 混合使用主機命名型網站集合與路徑型網站集合 (根網站集合除外)。Mixing host-named site collections and path-based site collections (except the root site collection).

  • 多個具有主機命名型網站集合的 Web 應用程式Multiple web applications with host-named site collections.

主機名稱網站集合與路徑型網站集合的比較Host-named site collections versus path-based site collections

使用主機命名型網站集合時,Web 應用程式中的每個網站集合都會獲得專屬的 DNS 名稱。在單一 Web 應用程式中部署許多主機命名型網站集合,可增加伺服器陣列的延展性,因為資源不會被用來支援多個應用程式集區和 Web 應用程式。When you use host-named site collections, each site collection in a web application is assigned a unique DNS name. When you deploy many host-named site collections to a single web application, you increase scalability of the farm because resources are not used to support multiple application pools and web applications.

SharePoint Server 可支援主機命名型網站集合和路徑型網站集合。下表詳述這兩個選項的差異,並提供主機命名型網站集合的更多資訊。SharePoint Server supports both host-named and path-based site collections. The following table details the differences between the two options and provides more information about host-named site collections.

表:主機命名型網站集合與路徑型網站集合的比較Table: Comparison of host-named site collections and path-based site collections

主機命名型網站集合Host-named site collections 路徑型網站集合Path-based site collections
建立網站Creating sites
您可以使用 Microsoft PowerShell 建立主機命名型網站集合。無法使用管理中心建立主機命名型網站集合。You can use Microsoft PowerShell to create host-named site collections. You cannot use Central Administration to create host-named site collections.
您可以使用管理中心或 PowerShell 建立路徑型網站集合。You can use Central Administration or PowerShell to create path-based site collections.
URLURLs
Web 應用程式中的每個主機命名型網站集合都會獲得專屬 DNS 名稱。Each host-named site collection in a web application is assigned a unique DNS name.
您可以使用區域,最多指派五個 URL 給主機命名型網站,包括虛名 URL 在內。You can use zones to assign up to five URLs to host-named sites, including vanity URLs.
Web 應用程式中的所有路徑型網站集合皆具有與 Web 應用程式相同的主機名稱 (DNS 名稱)。您可以擴充 Web 應用程式來實作最多五個區域,並為每個區域建立不同的主機名稱。不過,區域的主機名稱會套用至 Web 應用程式內的所有網站集合。All path-based site collections in a web application share the same host name (DNS name) as the web application. You can extend a web application to implement up to five zones and create different host names for each zone. However, the host name for a zone applies to all site collections within the web application.
根網站集合與搜尋Root site collection and search
根網站集合為在 Web 應用程式中編目內容時之所需。根網站集合可以是使用者無法存取的網站集合。A root site collection is required to crawl content in a web application. A root site collection can be a site collection that users cannot access.
Web 應用程式中通常以單一路徑型網站集合作為根網站集合。您可以使用受管理路徑,在 Web 應用程式中建立其他網站集合。Typically, a single path-based site collection serves as the root site collection within a web application. You can use managed paths to create additional site collections within the web application.
URL 對應URL mapping
使用 PowerShell 命令來管理 URL (Set-SPSiteURL、Remove-SPSiteURL、Get-SPSiteURL)。Use PowerShell commands to manage URLs (Set-SPSiteURL, Remove-SPSiteURL, Get-SPSiteURL).
使用備用存取對應來管理 URL。Use Alternate Access Mappings to manage URLs.
自助網站架設Self-service site creation
若要以主機命名型網站集合進行自助網站架設,您需要使用自訂的解決方案。You need to use a custom solution for self-service site creation with host-named site collections.
SharePoint Server 預設安裝的自助網站架設功能並不適用於已指定主機的網站集合。The Self Service Site Creation feature that is part of the default installation of SharePoint Server does not work with host-named site collections.
使用 SharePoint Server 預設安裝的自助網站架設功能時,會建立路徑型網站。When you use the Self Service Site Creation feature that is part of the default installation of SharePoint Server, you create path-based sites.
受管理路徑Managed paths
主機命名型網站集合的受管理路徑是在伺服器陣列層級套用,並且可用於所有 Web 應用程式。Managed paths for host-named site collections apply at the farm level and are available for all web applications.
您必須使用 PowerShell 建立主機命名型網站集合的受管理路徑。You have to use PowerShell to create managed paths for host-named site collections.
路徑型網站的受管理路徑是在 Web 應用程式層級套用。Managed paths for path-based sites apply at the web application level.
您可以使用管理中心或 Microsoft PowerShell 建立路徑型網站集合的受管理路徑。You can use Central Administration or Microsoft PowerShell to create managed paths for path-based site collections.

設計及管理主機命名型網站集合的 URLDesign and manage URLs for host-named site collections

PowerShell Cmdlet 可管理主機命名型網站集合的 URL 對應,並讓您將 URL 對應至單一網站集合:PowerShell cmdlets manage URL mappings for host-named site collections and enable you to map URLs to a single site collection:

  • Set-SPSiteUrl - 新增或變更網站的 URL 對應。Set-SPSiteUrl — Add or change a URL mapping for a site.

  • Remove-SPSiteUrl - 移除網站的 URL 對應。Remove-SPSiteUrl — Remove a URL mapping from a site.

  • Get-SPSiteUrl - 查看網站集合的所有 URL 和相關區域。Get-SPSiteUrl — See all URLs and associated zones for a site collection.

以上 Cmdlet 可提供主機命名型網站集合的 URL 對應功能,類似於備用存取對應。These cmdlets provide URL mapping functionality for host-named site collections that is similar to alternate access mapping.

區域與主機命名型網站集合Zones and host-named site collections

主機命名型網站集合可透過任何區域提供。主機命名型網站集合並不侷限於預設區域。如有需要,您可以實作多個區域,並使用區域及主機命名型網站集合來設定不同的驗證設定或原則。Host-named site collections are available through any zone. Host-named site collections are not limited to the default zone. If needed, you can implement multiple zones and use zones and host-named site collections to configure different authentication settings or policies.

注意

[!附註] 若要使用不同的區域,您必須擴充現有的 Web 應用程式。To use different zones you need to extend existing web application.

您可以每個區域各指派一個 URL,以最多指派五個 URL 給單一網站集合。即使您僅實作一個區域來遵循建議的架構,仍可以指派最多五個 URL 給主機命名型網站集合。這是因為如果未擴充 Web 應用程式來實作某個區域,則 SharePoint Server 會使用預設區域。You can assign up to five URLs to a single site collection by assigning one URL per zone. Even if you follow the recommended architecture by implementing only one zone, you can still assign up to five URLs to host-named site collections. This is because if a zone is not implemented by extending the web application, SharePoint Server uses the default zone.

例如,下列 URL 皆可用來存取同一個網際網路網站:For example, the following URLs could provide access to the same Internet site:

  • www.Contoso.comwww.Contoso.com

  • www.Contoso.ukwww.Contoso.uk

  • www.Contoso.cawww.Contoso.ca

  • www.Contoso.auwww.Contoso.au

  • www.Contoso.iewww.Contoso.ie

搜尋編目帳戶必須能夠使用整合式 Windows 驗證 (NTLM 或 Kerberos) 透過「預設」區域來存取內容。由於宣告驗證允許一個區域使用多種驗證類型,因此這項需求應該不會影響其他驗證需求。The search crawl account requires access to content through the Default zone by using Integrated Windows authentication (NTLM or Kerberos). Because claims authentication allows multiple types of authentication in one zone, this requirement should not affect other authentication requirements.

受管理路徑與主機命名型網站集合Managed paths and host-named site collections

設給同一個網站集合的 URL 雖然可以具有不同的配置和網域,但必須具有相同的受管理路徑,也就是說,網域後的 '/' 後的所有路徑皆必須相同。例如,http://www.Contoso.com/sites/Site1http://www.Fabrikam.com/sites/Site1 可指向同一個網站集合,但是 http://www.Contoso.com/sites/Site1http://www.bar.com/sites/Project1 則否。URLs that are configured for the same site collection may have different schemes and domains, but they must have the same managed paths, namely everything after the '/' that follows the domain must be the same. For example, http://www.Contoso.com/sites/Site1 and http://www.Fabrikam.com/sites/Site1 can both point to the same site collection but http://www.Contoso.com/sites/Site1 and http://www.bar.com/sites/Project1 cannot.

用來管理 URL 的 Cmdlet 只會對主機名稱的根網站集合 (例如 http://www.Contoso.com 執行。這些 Cmdlet 不會在根目錄下的受管理路徑網站集合 (例如 http://www.Contoso.com/sites/Project1 執行。位於主機命名型網站集合根目錄下的網站,將繼承該根主機命名型網站集合的 URL 設定。The cmdlets that manage URLs only operate on the root site collection for a host name, for example http://www.Contoso.com. These cmdlets do not operate on a managed path site collection that is underneath the root, such as http://www.Contoso.com/sites/Project1. Sites below the root of a host-named site collection will inherit the URL settings of that root host-named site collection.

將 SSL 的離線方塊終止用於主機命名型網站集合Off-box termination of SSL with host-named site collections

SSL 的離線方塊終止是指,Proxy 伺服器終止 SSL 要求,然後使用 HTTP 將要求轉送至網頁伺服器。若要對主機命名型網站集合達成 SSL 的離線方塊終止,將 SSL 連線終止的裝置 (例如反向 Proxy 伺服器) 必須能夠產生自訂 HTTP 標頭: Front-End-Https: On。如需詳細資訊,請參閱本文稍後的<將主機命名型網站集合與 SSL 的離線方塊終止搭配使用>。Off-box termination of SSL occurs when a proxy server terminates an SSL request and uses HTTP to forward the request to a web server. To achieve off-box SSL termination with host-named site collections, the device that terminates the SSL connection, such as a reverse proxy server, must be capable of generating a custom HTTP header: Front-End-Https: On. For more information, see Use host-named site collections with off-box SSL termination, later in this article.

主機命名型網站集合所用的通訊協定取決於您當初使用 Set-SPSiteURL Cmdlet 將 URL 對應至特定區域時所指定的 Url 參數值:http 或 https。請確定 Web 應用程式、SSL 憑證、反向 Proxy 設定和其他任何必要設定的 IIS 繫結皆完整。The protocol used for a host-named site collection depends on the value of the Url parameter that you specified when you used the Set-SPSiteURL cmdlet to map the URL to a particular zone: http or https. Ensure that the IIS bindings for the web application, SSL certificates, reverse proxy configuration, and any other configuration necessary is complete.

使用路徑型網站集合的時機When to use path-based site collections

儘管我們建議在大多數架構中使用主機命名型網站集合,但若有適用下列任一條件的情況,則應該使用傳統路徑型網站集合及備用存取對應:Although we recommend host-named site collections for most architectures, you should use the traditional path-based site collections and alternate access mapping if any of the following conditions apply:

  • 您必須使用屬於 SharePoint Server 預設安裝一部分的自助網站架設功能。You need to use the Self Service Site Creation feature that is part of the default installation of SharePoint Server.

    這不適用於自訂自助網站架設解決方案。This does not apply to custom self-service site creation solutions.

  • 需要 SSL 終止,但是無法設定您的 SSL 終止裝置以產生必要的自訂 HTTP 標頭。SSL termination is required but your SSL termination device cannot be configured to produce the necessary custom HTTP header.

    如果不需要 SSL 終止,您仍然可以使用 SSL 橋接主機命名型網站集合與這些裝置。You can still use SSL bridging with host-named site collections with these devices if SSL termination is not a requirement.

  • 您想使用不同的應用程式集區,以取得這些應用程式集區所提供的額外安全性,或您需要使用多個 Proxy 群組。You plan to use different application pools for the additional security that these provide or you need to use multiple proxy groups.

    在這些情況下,您可以使用主機命名型網站集合。不過,跨多個 Web 應用程式來對應主機命名型網站集合的 URL 所需要的其他設定,遠超過使用主機命名型網站集合的好處。如需詳細資訊,請參閱<將多個 Web 應用程式與主機命名型網站集合搭配使用>。如需如何建立路徑型網站集合的詳細資訊,請參閱<在 SharePoint Server 中建立網站集合>。In these cases, you can use host-named site collections. However, the additional configuration that is required to map URLs for host-named site collections across multiple web applications greatly outweigh the benefits of using host-named site collections. For more information, see Use multiple web applications with host-named site collections. For more information about creating path-based site collections, see Create a site collection in SharePoint Server.

使用主機標頭與主機命名型網站集合Use host headers and host-named site collections

主機標頭可讓網頁伺服器在相同的 IP 位址與連接埠組合裝載多個網站。如果傳入的 HTTP 要求包含主機標頭名稱,並且 IIS 中已設定相符的主機標頭,則 IIS 會以適當網站中的內容回應。Host headers allow the web server to host multiple web sites on the same IP Address and Port combination. If the incoming HTTP request includes a host header name, and a matching host header is configured in IIS, IIS will respond with the content from the appropriate web site.

主機標頭是在 Web 應用程式 (IIS 網站) 層級設定,且為其中一個網站繫結屬性。Host headers are configured at the Web Application (IIS web site) level, they are one of the website bindings properties.

了解 IIS 與已指定主機的網站集合中的主機標頭有何差異相當重要。IIS 網站層級的主機標頭僅預定用於路徑型網站集合。It is important to understand the distinction between Host headers in IIS and Host Named Site Collections. Host headers at the IIS web site level are only intended for path-based site collections.

使用已指定主機的網站集合時,SharePoint 負責根據透過 IIS 傳入的要求,將位址解析成正確的網站。在大部分情況下,在 IIS 網站層級套用主機標頭繫結後,將無法透過 IIS 網站存取已指定主機的網站集合。這是因為當要求是索取與主機標頭繫結不同的主機名稱時,IIS 就不會回應。When using Host named site collections, SharePoint is responsible for resolving the correct site for the address based upon the incoming request passed through IIS. In most cases, applying a host header binding at the IIS web site level makes it impossible to access host-named site collections through the IIS web site. This is because IIS will not respond to requests for host names that differ from the host header binding.

重要

如果現有的 web 應用程式的主機標頭繫結組,IIS 不會傳回頁面的主機命名型網站集合從直到您移除 IIS 繫結。如需詳細資訊,請參閱更新 web 應用程式 URL 和 IIS 繫結的 SharePoint 2013If an existing web application has a host header binding set, IIS will not return pages from the host-named site collection until you remove the binding from IIS. For more information, see Update a web application URL and IIS bindings for SharePoint 2013.

在同一個 Web 應用程式中混合使用主機名稱型網站集合與路徑型網站集合Mix host-named site collections and path-based site collections in the same web application

您可以在同一個 Web 應用程式中使用主機命名型網站集合和路徑型網站集合。若要確保這兩種類型的網站集合皆可供使用者存取,請勿將主機標頭繫結置於 Web 應用程式的 IIS 網站上,包括從 Web 應用程式擴充的區域本身的 IIS 網站。如果現有的 Web 應用程式具有主機標頭繫結集,則 IIS 將不會從主機命名型網站集合傳回頁面,除非您從 IIS 移除繫結。You can use host-named and path based site collections in the same web application. To ensure that both types of site collections are accessible to users, do not put host header bindings on the IIS website of your web application, including IIS websites for zones that are extended from the web application. If an existing web application has a host header binding set, IIS will not return pages from the host-named site collection until you remove the binding from IIS.

我的網站My Sites

當您對「我的網站」同時使用這兩種類型的網站集合時,請考慮實作您專屬的佈建程序以將「我的網站」建立為主機命名型網站,而非路徑型網站。When you use both types of site collections with My Sites, consider implementing your own provisioning process to create My Sites as host-named sites instead of path based sites.

主機命名型網站集合的部署與設定Deployment and configuration for host-named site collections

建立主機命名型網站集合的 Web 應用程式Create a web application for host-named site collections

如果您不想設定兩個以上的 IIS 網站,並讓這些網站共用同一個伺服器上的同一個連接埠號碼,請在預設區域中建立 Web 應用程式。請勿在 IIS 網站層級套用主機標頭繫結。If you do not intend to configure two or more IIS websites that share the same port number on the same server, create a web application in the Default zone. Do not apply a host header binding at the IIS website level.

若要建立已指定主機的網站集合的 Web 應用程式To create a web application for host-named site collections

  1. 確認您具備下列成員身分:Verify that you have the following memberships:

    • SQL Server 執行個體上的 securityadmin 固定伺服器角色。The securityadmin fixed server role on the SQL Server instance.

    • 待更新之所有資料庫上的 db_owner 固定資料庫角色。The db_owner fixed database role on all databases that are to be updated.

    • 您正在執行 Microsoft PowerShell Cmdlet 之伺服器上的管理員群組:The Administrators group on the server on which you are running the Microsoft PowerShell cmdlet.

      系統管理員可以使用 Add-SPShellAdmin Cmdlet 授與使用 SharePoint Server Cmdlet 的權限。An administrator can use the Add-SPShellAdmin cmdlet to grant permissions to use SharePoint Server cmdlets.

      注意

      [!附註] 如果您不具備上述權限,請連絡安裝程式系統管理員或 SQL Server 系統管理員要求權限。如需 PowerShell 權限的其他資訊,請參閱 Add-SPShellAdminIf you do not have permissions, contact your Setup administrator or SQL Server administrator to request permissions. For additional information about PowerShell permissions, see Add-SPShellAdmin.

  2. 開啟 [ SharePoint 管理命令介面]。Open the SharePoint Management Shell.

  3. 在 PowerShell 命令提示字元 (即 PS C:\>) 處,輸入下列語法:At the PowerShell command prompt (that is, PS C:\>), type the following syntax:

    New-SPWebApplication -Name 'Contoso Sites' -port 80 -ApplicationPool ContosoAppPool -ApplicationPoolAccount (Get-SPManagedAccount 'Contoso\JDoe') -AuthenticationProvider (New-SPAuthenticationProvider -UseWindowsIntegratedAuthentication)
    

建立根網站集合Create a root site collection

根網站集合是任何 Web 應用程式都需要有的項目。它也是編目內容時需要有的項目。此網站集合必須具有與 Web 應用程式相同的 URL。目前,SharePoint 會防止以與 Web 應用程式相同的 URL 建立主機命名型網站集合。因此,根網站集合會建立為路徑型網站集合。A root site collection is a requirement for any Web application. It is also necessary for crawling content. This site collection must have the same URL as the Web application. Currently, SharePoint prevents the creation of a host-named site collection with the same URL as a Web application. Therefore, the root site collection is created as a path-based site collection.

A web application with a root site.

以下範例建立此根網站集合的空網站集合:The following example creates an empty site collection that is the root site collection:

New-SPSite 'http://<servername>' -Name 'Portal' -Description 'Portal on root' -OwnerAlias 'contoso\administrator' -language 1033 -Template 'STS#0'

只有 Web 應用程式的根網站集合會出現在內容來源中。即使 Web 應用程式中所有其餘主機命名型網站集合未出現在內容來源中,搜尋作業預設還是會自動編目其餘主機命名型網站集合。Only the root site collection of the web application appears in the content source. Even though all other host-named site collections in the web application do not appear in the content source, by default search automatically crawls the other host-named site collections.

建立主機命名型網站集合Create host-named site collections

您必須使用 Microsoft PowerShell 來建立已指定主機的網站集合。您不可使用 SharePoint Server管理中心 Web 應用程式來建立已指定的網站集合,但是您可以在建立之後,使用 管理中心 管理網站集合。You must use Microsoft PowerShell to create a host-named site collection. You cannot use the SharePoint ServerCentral Administration web application to create a host-named site collection, but you can use Central Administration to manage the site collection after you have created it.

您可以使用帶有 -HostHeaderWebApplication 參數之 Microsoft PowerShell New-SPSite Cmdlet 來建立已指定主機的網站集合,如以下範例所示:You can create a host-named site collection by using the Microsoft PowerShell New-SPSite cmdlet with the -HostHeaderWebApplication parameter, as shown in the following example:

建立已指定主機的網站集合To create host-named site collections

  1. 確認您具備下列成員身分:Verify that you have the following memberships:

    • SQL Server 執行個體上的 securityadmin 固定伺服器角色。The securityadmin fixed server role on the SQL Server instance.

    • 待更新之所有資料庫上的 db_owner 固定資料庫角色。The db_owner fixed database role on all databases that are to be updated.

    • 您正在執行 Microsoft PowerShell Cmdlet 之伺服器上的管理員群組:The Administrators group on the server on which you are running the Microsoft PowerShell cmdlet.

      系統管理員可以使用 Add-SPShellAdmin Cmdlet 授與使用 SharePoint Server Cmdlet 的權限。An administrator can use the Add-SPShellAdmin cmdlet to grant permissions to use SharePoint Server cmdlets.

      注意

      [!附註] 如果您不具備上述權限,請連絡安裝程式系統管理員或 SQL Server 系統管理員要求權限。如需 PowerShell 權限的其他資訊,請參閱 Add-SPShellAdminIf you do not have permissions, contact your Setup administrator or SQL Server administrator to request permissions. For additional information about PowerShell permissions, see Add-SPShellAdmin.

  2. 開啟 [ SharePoint 管理命令介面]。Open the SharePoint Management Shell.

  3. 在 PowerShell 命令提示字元 (即 PS C:\>) 處,輸入下列語法:At the PowerShell command prompt (that is, PS C:\>), type the following syntax:

    New-SPSite 'http://portal.contoso.com' -HostHeaderWebApplication (Get-SPWebApplication 'Contoso Sites') -Name 'Portal' -Description 'Customer root' -OwnerAlias 'contoso\administrator' -language 1033 -Template 'STS#0'
    

這會在具備 http://webapp.contoso.com 之 URL 的 SharePoint Server Web 應用程式中,建立具備 http://webapp.contoso.com 之 URL 的已指定主機的網站集合。This creates a host-named site collection that has the URL, http://webapp.contoso.com, in the SharePoint Server web application that has the URL, http://webapp.contoso.com.

將受管理路徑與主機命名型網站集合搭配使用Use managed paths with host-named site collections

您可以實作以主機命名型網站集合的受管理的路徑。Hosters (英文) 至相同的客戶可以提供的多個網站集合與共用客戶的唯一的主機名稱每個網站集合,但區別之後的主機名稱的 URL 路徑。每個伺服器陣列 20 個主機命名型網站集合的受管理的路徑。如需詳細資訊,請參閱SharePoint Server 2016 的軟體界限及限制You can implement managed paths with host-named site collections. Hosters can provide multiple site collections to the same customer with each site collection sharing the customer's unique host name but differentiated by the URL path after the host name. Managed paths for host-named site collections are limited to 20 per farm. For more information, see Software boundaries and limits for SharePoint Server 2016.

主機命名型網站集合的受管理路徑與路徑型網站集合的受管理路徑在行為上有所不同。無論主機命名型網站集合是否在 Web 應用程式中,主機命名型網站集合的受管理路徑皆可用於伺服器陣列中的所有主機命名型網站集合。相反地,路徑型網站集合的受管理路徑僅適用於相同 Web 應用程式中的網站。路徑型網站集合的受管理路徑不適用於其他 Web 應用程式中的路徑型網站集合。單一類型網站集合的受管理路徑不適用於其他類型的網站集合。Managed paths for host-named site collections behave differently from managed paths for path-based site collections. Managed paths for host-named site collections are available to all host-named site collections within the farm regardless of the web application that the host-named site collection is in. In contrast, managed paths for path-based site collections only apply to sites within the same web application. Managed paths for path-based site collections do not apply to path-based site collections in other web applications. Managed paths for one type of site collection do not apply to the other type of site collection.

若要建立受管理路徑,您必須先建立具有想要之基底 URL的網站集合。例如,若要建立 http://teams.contoso.com/ finance,您必須先建立 http://teams.contoso.com 的網站集合。To create a managed path, you must first create a site collection with the desired base URL. For example, to create http://teams.contoso.com/ finance you must first create the site collection for http://teams.contoso.com.

若要建立受管理路徑以用於主機命名型網站集合,請使用帶有 HostHeader 參數的 PowerShell New-SPManagedPath Cmdlet,如以下範例所示:To create a managed path for use with host-named site collections, use the PowerShell New-SPManagedPath cmdlet with the HostHeader parameter, as shown in the following example:

New-SPManagedPath 'departments' -HostHeader

您也可以使用 Explicit 參數建立明確的受管理路徑。You can also use the Explicit parameter to create explicit managed paths.

以下範例顯示在受管理路徑建立的已指定主機的網站集合:The following example shows a host-named site collection created at a managed path:

New-SPSite 'http://portal.contoso.com/departments/marketing' -HostHeaderWebApplication (Get-SPWebApplication 'Contoso Sites') -Name 'Marketing' -Description 'Portal Marketing' -OwnerAlias 'contoso\administrator' -language 1033 -Template 'STS#0'

若要移除現有的受管理路徑,請使用 PowerShell Remove -SPManagedPath Cmdlet,如以下範例所示:To remove an existing managed path, use the PowerShell Remove -SPManagedPath cmdlet, as shown in the following example:

Remove-SPManagedPath 'departments' -HostHeader

即使網站集合存在,您可以使用 PowerShell 來移除受管理路徑。如果您移除受管理路徑,則無法再存取網站集合。若要存取現有的網站集合,請使用 PowerShell 以重新建立受管理路徑。You can use PowerShell to remove a managed path even if a site collection exists. If you remove a managed path, the site collection can no longer be accessed. To access the existing site collection, use PowerShell to recreate the managed path.

將 URL 對應至主機命名型網站集合Map URLs to host-named site collections

當您建立新的主機命名型網站集合時,預設的備用存取對應仍會存在,但無法使用。請使用 PowerShell 命令來管理主機命名型網站集合的 URL 對應。When you create a new hostname site collection, the default alternate access mappings will still exist but cannot be used. Use PowerShell commands to manage URL mappings for host-named site collections.

將對應新增至現有網站:Add a mapping to an existing site:

Set-SPSiteUrl (Get-SPSite 'http://teams.contoso.com') -Url 'http://teamsites.contoso.com' -Zone Intranet

每一個 URL 對應會套用至單一區域。當您對應 URL 時,請使用以下其中一個區域名稱:Each URL mapping is applied to a single zone. Use one of the following zone names when you map URLs:

  • 預設Default

  • 內部網路Intranet

  • 網際網路Internet

  • 自訂Custom

  • 外部網路Extranet

如果您未指定 Zone 參數,且 URL 對應項目是新的,則會使用預設區域。您還會有唯一的網站集合 5 個 URL 的限制。If you do not specify the Zone parameter and the URL mapping entry is new, the default zone is used. You still have a limitation to 5 URLs for a unique Site Collection.

移除網站的對應:Remove a mapping for a site:

Remove-SPSiteUrl 'http://teamsites.contoso.com'

顯示網站的所有 URL 對應:Display all URL mappings for a site:

Get-SPSiteUrl -Identity (Get-SPSite 'http://teams.contoso.com')

設定主機命名型網站集合的 SSL 憑證Configure SSL certificates for host-named site collections

您可以設定使用 SSL 的單一 Web 應用程式,然後在該 Web 應用程式中建立多個主機命名型網站集合。若要在整個 SSL 瀏覽網站,您必須安裝並指派憑證至 IIS 網站。Web 應用程式中的每一個主機命名型網站集合將共用您指派至 IIS 網站的單一伺服器憑證。You can configure a single web application that uses SSL and then create multiple host-named site collections within that web application. To browse to a site over SSL, you have to install and assign a server certificate to the IIS website. Each host-named site collection in a web application will share the single server certificate that you assigned to the IIS website.

您必須取得萬用字元憑證或主體別名 (SAN) 憑證,然後使用符合該憑證之主機命名型網站集合 URL 格式。例如,如果您取得 *.contoso.com 萬用字元憑證,必須產生主機命名型網站集合 URL (例如 https://site1.contoso.com、https://site2.contoso.com 等等),讓這些網站可通過瀏覽器 SSL 驗證。然而,如果您需要網站的唯一第二層網域名稱,則必須建立多個 Web 應用程式,而非多個主機命名型網站集合。You need to acquire a wildcard certificate or subject alternate name (SAN) certificate and then use a host-named site collection URL format that matches that certificate. For example, if you acquire a *.contoso.com wildcard certificate, you must generate host-named site collection URLs such as https://site1.contoso.com, https://site2.contoso.com, and so on, to enable these sites to pass browser SSL validation. However, if you require unique second-level domain names for sites, you must create multiple web applications rather than multiple host-named site collections.

若要針對主機命名型網站集合設定 SSL,請在建立 Web 應用程式時啟用 SSL。這將會建立帶有 SSL 繫結而非 HTTP 繫結的 IIS 網站。建立 Web 應用程式之後,請開啟 IIS 管理員並指派憑證給該 SSL 繫結。接著,您可以在該 Web 應用程式中建立網站集合。To configure SSL for host-named site collections, enable SSL when you create the web application. This will create an IIS website with an SSL binding instead of an HTTP binding. After you create the web application, open IIS Manager and assign a certificate to that SSL binding. You can then create site collections in that web application.

如果您要將多個區域與主機命名型網站集合搭配實作,請確保憑證與繫結 (SSL 或 HTTP) 的設定適用於每一個區域和對應的 IIS 網站。If you are implementing multiple zones with host-named site collections, ensure that the configuration of certificates and bindings (SSL or HTTP) is appropriate for each zone and corresponding IIS site.

將主機命名型網站集合與 SSL 的離線方塊終止搭配使用Use host-named site collections with off-box SSL termination

您可以將主機命名型網站集合與 SSL 的離線方塊終止搭配使用。將 SSL 終止與主機命名型網站集合搭配使用有數種要求:You can use host-named site collections with off-box SSL termination. There are several requirements to use SSL termination with host-named site collections:

  • 至少一個 IIS 網站應該在連接埠 80 (或者是終端子轉送要求的目標連接埠) 上具備繫結。Microsoft 建議您將 Web 應用程式的 IIS 網站 (或者是適用於 Web 應用程式之區域的 IIS 網站) 與 HTTP/80 搭配使用。At least one IIS site should have a binding on port 80 (or whatever port the terminator forwards the request to). Microsoft recommends that you use the IIS site of a web application (or the IIS site of a zone for a web application) with HTTP/80.

  • SSL 終端子或反向 Proxy 必須保留用戶端的原始 HTTP 主機標頭。The SSL terminator or reverse proxy must preserve the original HTTP host header from the client.

  • 如果用戶端 SSL 要求已傳送至預設 SSL 連接埠 (443),則 SSL 終端子或反向 Proxy 必須將加密的 HTTP 要求轉送至預設 HTTP 連接埠 (80) 上的前端網頁伺服器。如果用戶端 SSL 要求已傳送至非預設 SSL 連接埠,則 SSL 終端子或反向 Proxy 必須將加密的 HTTP 要求轉送至同一個非預設連接埠的前端網頁伺服器。If the client SSL request is sent to the default SSL port (443), then the SSL terminator or reverse proxy must forward the decrypted HTTP request to the front-end web server on the default HTTP port (80). If the client SSL request is sent to a non-default SSL port, then the SSL terminator or reverse proxy must forward the decrypted HTTP request to the front-end web server on the same non-default port.

  • 終止 SSL 連線的裝置 (例如反向 Proxy 伺服器) 必須能夠產生自訂 HTTP 標頭: Front-End-Https: On。這是 Outlook Web Access (OWA) 使用的相同自訂標頭: Front-End-Https: On/Off。關於此自訂標頭的詳細資訊包含在稍後出現的本節中。The device that terminates the SSL connection, such as a reverse proxy server, must be capable of generating a custom HTTP header: Front-End-Https: On. This is the same custom header that Outlook Web Access (OWA) uses: Front-End-Https: On/Off. More information about this custom header is included later in this section.

若要將主機命名型網站集合與 SSL 的離線方塊終止搭配使用,請像往常針對 SSL 終止一樣設定您的 Web 應用程式,並確保其符合上述需求。在此案例中,SharePoint Server 將使用 HTTPS 而非 HTTP,以在該 Web 應用程式中呈現其主機命名型網站集合的連結。To use host-named site collections with off-box SSL termination, configure your web application as you normally would for SSL termination and ensure that it meets the requirements described above. In this scenario, SharePoint Server will use HTTPS instead HTTP to render links of its host-named site collections in that web application.

反向 Proxy 伺服器可以發佈 SharePoint Server 已指定主機的網站集合,並執行 SSL 的離線方塊終止。在此案例中,反向 Proxy 伺服器會將使用者和 SharePoint Web 前端伺服器之間的連線類型從 SSL/TLS 變更為 HTTP,反之亦然。此案例中的反向 Proxy 伺服器必須在轉送要求給 SharePoint Web 前端伺服器時,在使用者要求中插入額外的 HTTP 標頭。此額外的 HTTP 標頭表示使用者起始 SharePoint Server 的連線類型,以便 SharePoint Server 在其回應中適當呈現 URL。HTTP 標頭名稱為 "Front-End-Https",其可接受的值如下所示。Reverse proxy servers can publish SharePoint Server host-named site collections and perform off-box SSL termination. In this scenario, the reverse proxy server changes the connection type between the end user and the SharePoint web front-end server from SSL/TLS to HTTP or vice versa. Reverse proxy servers in this scenario must insert an additional HTTP header in the user's request when it forwards the request to the SharePoint web front-end server. This additional HTTP header indicates to SharePoint Server the type of connection the end user initiated so that SharePoint Server renders URLs appropriately in its response. The HTTP header name is "Front-End-Https" and its acceptable values are as follows.

表:Front-End-Https 標頭值Table: Front-End-Https header values

Value 描述Description
OnOn
反向 Proxy 伺服器會接收透過加密 (SSL 或 TLS) HTTPS 連線的使用者要求。例如, Front-End-Https: OnThe reverse proxy server received the end user's request over an encrypted (SSL or TLS) HTTPS connection. For example, Front-End-Https: On.
OffOff
反向 Proxy 伺服器會接收透過未加密 HTTP 連線的使用者要求。The reverse proxy server received the end user's request over an unencrypted HTTP connection.

此值不分大小寫。例如,on、ON、On 及 oN 皆可接受。The values are not case-sensitive. For example, on, ON, On, and oN are acceptable.

該自訂標頭只會與主機命名型網站集合搭配使用。不會與路徑型網站集合搭配使用。This custom header works only with host-named site collections. It does not work with path-based site collections.

以下範例顯示在 https 建立的已指定主機的網站集合:The following example shows a host-named site collection created at https:

New-SPSite 'https://portal.contoso.com' -HostHeaderWebApplication  (Get-SPWebApplication 'Contoso Sites') -Name 'Portal' -OwnerAlias 'contoso\administrator' -language 1033 -Template 'STS#0'

此範例會在具備 https://portal.contoso.com 之 URL 的 SharePoint Server Web 應用程式中,建立具備 http://webapp.contoso.com 之 URL 的已指定主機的網站集合。This example creates a host-named site collection that has the URL, https://portal.contoso.com, in the SharePoint Server web application that has the URL http://webapp.contoso.com.

透過多個區域啟用環境中的應用程式Enable apps in environments with multiple zones

注意

[!附註] 本節僅適用於 SharePoint Server 2013This section applies only to SharePoint Server 2013

2013 年 3 月公用更新可讓您為每一個 Web 應用程式區域設定應用程式網域,並使用備用存取對應,以及主機標頭 Web 應用程式設定。此更新上市之後,您可以僅主控一個應用程式網域,而且其必須位於預設區域中。您無法使用備用存取對應或主機標頭 Web 應用程式設定上的應用程式網域。The March 2013 Public Update enables you to configure an app domain for each web application zone and use alternate access mapping and host-header web application configuration. Before the release of this update, you could only host one app domain and it had to be in the Default zone. You could not use the app domain on alternate access mappings or host-header web application configurations.

若要解決此問題,請套用 SharePoint Server 累計更新伺服器 Hotfix 套件:2013 年 3 月 12 日,請參閱<更新 SharePoint 2013>。To resolve this issue, apply the SharePoint Server Cumulative Update Server Hotfix Package: March 12, 2013, see Updates for SharePoint 2013.

將路徑型網站集合移轉至主機命名型網站集合Migrate path-based site collections to host-named site collections

決定現有 Web 應用程式中的主機命名型網站集合Determine host-named site collections in existing web applications

當您從 SharePoint Server 2010 移轉至 SharePoint Server 時,建議您判斷建立 SharePoint Server 2010 網站的方法。如果網站建立為路徑型網站,請考慮將這些網站移轉至已指定主機的網站集合。如果同時實作按主機命名與路徑型網站集合,請識別建立為路徑型網站的網站,並考慮將這些網站移轉至已指定主機的網站集合。若要完成此工作,請尋找 'HostHeaderIsSiteName' 旗標。When you migrate from SharePoint Server 2010 to SharePoint Server, we recommend that you determine how SharePoint Server 2010 sites were created. If sites were created as path-based sites, consider migrating these sites to host-named site collections. If host-named and path-based sites were implemented together, identify the sites that were created as path-based sites and consider migrating these sites to host-named site collections. To accomplish this, look for the 'HostHeaderIsSiteName' flag.

以下範例可判斷指定的 Web 應用程式是否已建立為按主機命名或路徑型:The following example determines if a site within a given web application is created as host-named or path based:

$webApp = Get-SPWebapplication 'http://webapp.contoso.com'
foreach($spSite in $webApp.Sites)
{
if ($spSite.HostHeaderIsSiteName) 
{ Write-Host $spSite.Url 'is host-named' }
else
{ Write-Host $spSite.Url 'is path based' }
}

將路徑型網站集合轉換至主機命名型網站集合Convert path-based site collections to host-named site collections

您可以將路徑型網站集合轉換至主機命名型網站集合,也可以將主機命名型網站集合轉換至路徑型網站集合。您必須使用 PowerShell 備份與還原 Cmdlet 以轉換網站集合。不可使用附加與卸離,或裝載與卸載內容資料庫的 SharePoint 管理中心網站或 PowerShell Cmdlet 來轉換網站集合。You can convert path-based site collections to host-named site collections and host-named site collections to path-based site collections. You have to use the PowerShell backup and restore cmdlets to convert site collections. You cannot use the the SharePoint Central Administration website or PowerShell cmdlets that attach and detach, or mount and dismount content databases to convert site collections.

以下範例可將標準網站集合轉換至主機命名型網站集合:The following example converts a standard site collection to a host-named site collection:

Backup-SPSite -Identity 'http://portalOld.contoso.com' -Path 'c:\Backup\portalContoso.bak' -Force -UseSQLSnapShot
Restore-SPSite -Identity 'http://portal.contoso.com' -Path 'c:\Backup\portalContoso.bak' -DatabaseName 'portal_content' -Force -HostHeaderWebApplication 'http://webapp.contoso.com' -Confirm:$false

重要

[!重要事項] 您不能在 SharePoint Server 2010 環境上執行 Backup-SPSite Cmdlet,以及從 SharePoint Server 環境使用 Restore-SPSite Cmdlet。備份與還原作業必須從相同的主要產品版本進行。您可以在 SharePoint Server 轉換為已指定主機的網站集合之前,在其中移轉或附加路徑式網站集合之前,先在 SharePoint Server 2010 中將路徑式網站集合轉換為已指定主機的網站集合。You cannot run the Backup-SPSite cmdlet on a SharePoint Server 2010 environment and use the Restore-SPSite cmdlet from the SharePoint Server environment. The Backup and Restore operation need to be from the same major product versions. You can convert path based site collections in SharePoint Server 2010 to host-named site collections before migration or attach path-based site collections in SharePoint Server before converting to host-named site collections.

將多個 Web 應用程式與主機命名型網站集合搭配使用Use multiple web applications with host-named site collections

如果您使用一個以上的 Web 應用程式,會對系統增加更多作業負荷和複雜度。建議您針對網站集合使用一個 Web 應用程式。不過,以下原因可能會影響您跨多個 Web 應用程式實作網站集合:If you use more than one web application, you add more operational overhead and complexity to the system. We recommend that you use one web application for site collections. However, the following reasons might influence you to implement site collections across multiple web applications:

  • 組織的安全性原則需要不同的 Web 應用程式或應用程式集區。An organization's security policies require separate web applications or application pools.

  • Web 應用程式需要以不同方式設定。Web applications need to be configured differently.

  • 組織需要使用多個 Proxy 群組。An organization requires the use of multiple proxy groups.

搭配伺服器陣列中的多個 Web 應用程式實作主機命名型網站集合,會比較複雜,因為您必須完成更多設定步驟。例如,主機命名型網站的 URL 可能會分散到共用單一伺服器陣列中相同連接埠的多個 Web 應用程式。此案例需要更多設定步驟,以確定將要求對應至正確的 Web 應用程式。您必須手動設定伺服器陣列中每部網頁伺服器上的對應,方法是設定代表每個 Web 應用程式的不同 IP 位址。您也必須建立及管理主機標頭繫結,為每個網站指定唯一的 IP 位址。指令碼可跨伺服器管理及複寫此設定,但是這麼做會增加解決方案的複雜性。每個唯一的 URL 也需要 DNS 的對應。一般而言,如果需要多個 Web 應用程式,建議改用路徑型網站集合並搭配備用存取對應。It is more complex to implement host-named site collections with multiple web applications in a farm because you must complete more configuration steps. For example, URLs with host-named sites might be spread across multiple web applications that share the same port in a single farm. This scenario requires more configuration steps to ensure that requests are mapped to the correct web applications. You have to manually configure the mappings on each web server in the farm by configuring a separate IP address to represent each web application. You also have to create and manage host-header bindings to assign unique IP addresses for each site. Scripts can manage and replicate this configuration across servers; however, this adds complexity to the solution. Each unique URL also requires a mapping in DNS. Generally speaking, if multiple web applications are a requirement, we recommend path-based site collections with alternate access mapping.

以下兩張表格比對實作網站集合的三種不同設計選擇。這些表格可協助您了解每一種方法的結果,以及設定如何依據架構而變化。The following two tables contrast three different design choices to implement site collections. These tables are intended to help you understand the consequences of each approach and how configuration varies depending on the architecture.

表:佈建網站集合之不同設計選擇的結果Table: Results of different design choices to provision site collections

伺服器陣列中的所有網站合併到一個 Web 應用程式中的主機命名型網站集合Host-named site collections with all sites in a farm consolidated in one web application 搭配備用存取對應及多個 Web 應用程式的路徑型網站集合Path-based site collections with alternate access mapping and multiple web applications 伺服器陣列中搭配多個 Web 應用程式的按主機命名的網站集合Host-named site collections with multiple web applications in a farm
網站集合佈建Site collection provisioning
使用 Microsoft PowerShell 或自訂網站集合佈建解決方案佈建網站。Use Microsoft PowerShell or a custom site collection provisioning solution to provision sites.
使用管理中心或 Microsoft PowerShell 部署網站。Use Central Administration or Microsoft PowerShell to deploy sites.
使用 Microsoft PowerShell 或自訂網站集合佈建解決方案佈建網站。Use Microsoft PowerShell or a custom site collection provisioning solution to provision sites.
URL 管理URL management
您可以對應 DNS 中的所有網站集合,以指向代表 Web 應用程式的單一 IP 位址。You can map all site collections in DNS to point to a single IP address which represents the web application.
如果您實作多個區域,則會為每個網站 URL 設定備用存取對應。每個區域也需要 DNS 的對應。If you implemented more than one zone, you configure alternate access mapping for each site URL. Each zone also requires a mapping in DNS.
您需要其他設定,以確保共用相同連接埠之網站的要求對應至正確的 Web 應用程式。每個唯一的主機名稱也需要 DNS 的對應。此設定為手動,且必須針對每個網站,在伺服器陣列中的每部網頁伺服器上完成。Additional configuration is required to ensure that requests for sites that share the same port are mapped to the correct web application. Each unique host name also requires a mapping in DNS. This configuration is manual and you must complete it on each web server in a farm for each site.
其他 URLAdditional URLs
您最多可以對主機命名型網站集合指派五個 URL,每個區域一個。您不需要將 Web 應用程式延伸至多個區域。如果某個區域尚未實作,將會使用預設區域。You can assign up to five URLs to a host-named site collection, one per zone. It is not necessary to extend the web application to multiple zones. If a zone is not implemented the default zone is used.
網站集合的 URL 數目限制為 5,因為這是允許的區域數目。The number of URLs for a site collection is limited to five because this is the number of zones that is allowed.
您最多可以對主機命名型網站集合指派五個 URL,每個區域一個。您不需要將 Web 應用程式延伸至多個區域。如果某個區域尚未實作,將會使用預設區域。You can assign up to five URLs to a host-named site collection, one per zone. It is not necessary to extend the web application to multiple zones. If a zone is not implemented the default zone is used.
服務應用程式Service applications
陣列伺服器中的所有網站會使用單一服務應用程式群組。All sites in the farm use a single service application group.
您可以為不同的 Web 應用程式實作自訂服務應用程式群組。You can implement custom service application groups for different web applications.
您可以為不同的 Web 應用程式實作自訂服務應用程式群組。You can implement custom service application groups for different web applications.
區域Zones
您不需要實作多個區域來為同一個網站集合實作不同的 URL。如果某個區域尚未實作,將會使用預設區域。You do not have to implement multiple zones to implement different URLs for the same site collection. If a zone is not implemented the default zone is used.
為相同網站集合實作不同 URL 所需的區域。Zones are necessary to implement different URLs for the same site collection.
您不需要實作多個區域來為同一個網站集合實作不同的 URL。如果某個區域尚未實作,將會使用預設區域。You do not have to implement multiple zones to implement different URLs for the same site collection. If a zone is not implemented the default zone is used.
驗證Authentication
每個 Web 應用程式的驗證選項限制為五個區域。但是,您可以在一個區域中實作多種驗證方法。With one web application, authentication options are limited to five zones. However, you can implement many authentication methods on one zone.
您可以為每個 Web 應用程式實作不同的驗證與區域設計。You can implement different authentication and zone designs for each web application.
您可以為每個 Web 應用程式實作不同的驗證與區域設計。You can implement different authentication and zone designs for each web application.
驗證Authentication
提供網域 URL 之間的用戶端指令碼隔離。Provides client scripting isolation between domain URLs.
如有需要,您可以將 Web 應用程式隔離至專用應用程式集區,以達到處理序隔離的目的。You can isolate web applications into dedicated application pools, if desired, to achieve process isolation.
提供網域 URL 之間的隔離。Provides isolation between domain URLs.
如有需要,您可以將 Web 應用程式隔離至專用應用程式集區,以達到處理序隔離的目的。You can isolate web applications into dedicated application pools, if desired, to achieve process isolation.
提供網域 URL 之間的隔離。Provides isolation between domain URLs.
原則Policy
您可以使用區域以指派不同的原則至按主機命名的網站。You can use zones to assign different policies to host-named sites.
不論是在個別網站或文件設定權限,您可以在 Web 應用程式層級使用原則以強制執行權限。此外,您可以對不同區域實作不同原則。You can use policies at the web application level to enforce permissions, regardless of permissions that are configured on individual sites or documents. Additionally, you can implement different policies for different zones.
不論是在個別網站或文件設定權限,您可以為不同的 Web 應用程式實作不同的原則以強制執行權限。You can implement different policies for different web applications to enforce permissions, regardless of permissions that are configured on individual sites or documents.
此外,您可以對不同區域實作不同原則。Additionally, you can implement different policies for different zones.

其他也可能影響設計決策的延展性數值包括建議的網站集合、內容資料庫及管理路徑數目上限。Scalability numbers that might also affect design decisions include the recommended maximums for site collections, content databases, and managed paths.

下表摘要說明根據本文所述之三種設計選擇之一管理 URL 所需的設定。The following table summarizes the configuration that is necessary to manage URLs based on each of the three design options presented in this article.

表:不同網站集合設計所需的設定Table: Configuration required for different site collection designs

伺服器陣列中的所有網站合併到一個 Web 應用程式中的主機命名型網站集合Host-named site collections with all sites in a farm consolidated into one web application 搭配備用存取對應及多個 Web 應用程式的路徑型網站集合Path-based site collections with alternate access mapping and multiple web applications 伺服器陣列中搭配多個 Web 應用程式的按主機命名的網站集合Host-named site collections with multiple web applications in a farm
在 SharePoint Server 中Within SharePoint Server
建立 Web 應用程式。Create the web application.
建立使用者無法存取的根網站集合 (例如 https://HNSC01.fabrikam.com)。Create a root-site collection that is not accessible to users (for example, https://HNSC01.fabrikam.com).
使用主機標頭建立主機命名型網站集合 (例如 https://intranet.fabrikam.com)。Create the host-named site collections with the host header (for example, https://intranet.fabrikam.com).
(選用) 為每個網站集合新增更多 URL,並使用 Set-SPSiteUrl 設定區域。(在公司入口網站設計範例中不需要,因為只有一個區域)。 Optionally add more URLs for each site collection and configure zones by using Set-SPSiteUrl. (In corporate portal design samples there's no need because there's only one zone.)
使用主機標頭建立 Web 應用程式 (例如 https://intranet.fabrikam.com)。Create the web application with the host header (for example, https://intranet.fabrikam.com).
(選用) 設定備用存取對應。在此設計範例中不需要,因為只有一個區域。Optionally configure alternate access mapping. In the design sample there's no need because there's only one zone).
建立根路徑型網站集合。Create the root path-based site collection.
建立 Web 應用程式。Create the web application.
建立使用者無法存取的根網站集合 (例如 https://HNSC01.fabrikam.com)。Create a root-site collection that is not accessible to users (for example, https://HNSC01.fabrikam.com).
使用主機標頭建立主機命名型網站集合 (例如 https://intranet.fabrikam.com)。Create the host-named site collections with the host header (for example, https://intranet.fabrikam.com).
(選用) 為每個網站集合新增更多 URL,並使用 Set-SPSiteUrl 設定區域。(在公司入口網站設計範例中不需要,因為只有一個區域)。 Optionally add more URLs for each site collection and configure zones by using Set-SPSiteUrl. (In corporate portal design samples there's no need because there's only one zone.)
在 IIS 中Within IIS
為 Web 應用程式中的所有按主機命名的網站 (網域),分別關聯一個 SSL 憑證 (萬用字元憑證或 SAN 憑證)。Associate an SSL certificate (wildcard certificate or SAN certificate) for all host-named site (domain) in the web application.
在 IIS 中,為每個區域分別關聯一個 SSL 憑證 (每個區域在 IIS 中屬於不同的 Web 應用程式)。Associate an SSL certificate in IIS for each zone (each zone is a separate web application in IIS).
為 Web 應用程式中的按主機命名的網站 (網域),關聯一個 SSL 憑證 (萬用字元憑證或 SAN 憑證)。Associate an SSL certificate (wildcard certificate or SAN certificate) for a host-named site (domain) in the web applications.
在伺服器陣列的每部網頁伺服器上,以及針對共用連接埠的每個 Web 應用程式:On each web server in the farm and for each web application that shares a port:
設定代表每個 Web 應用程式的不同 IP 位址。Configure a separate IP address to represent each web application.
手動編輯 IIS 網站繫結,以移除建立 Web 應用程式時所建立的主機標頭繫結,並取代為 IP 位址繫結。Edit the IIS web site binding manually to remove the host header binding that was created when the web application was created and replace this with an IP address binding.

如果在不同的 IP 位址上使用多個 Web 應用程式,您可能需要針對每一部伺服器的 NIC、DNS,以及負載平衡器完成其他設定。If you use multiple web applications on different IP addresses, you might need to complete additional configuration for the NIC, DNS, and the load balancer for each server.

透過主機命名型網站集合建立多個 Web 應用程式Create multiple web applications with host-named site collections

若要在與主機命名型網站集合搭配使用的相同伺服器和連接埠上執行多個 Web 應用程式,您必須指派不同的 IP 位址給 Web 應用程式。此架構類型必須將 IP 位址新增至網路伺服器,並設定網路路由器,以將主機名稱指向其 Web 應用程式的 IP 位址。To run multiple web applications on the same server and port in combination with host-named site collections, you have to assign different IP addresses to the web applications. This type of architecture requires that you add IP addresses to the web servers and configure the network router to point host names to the IP address of its web application.

注意

您可以建立沒有主機標頭的 Web 應用程式。如果您要建立沒有主機標頭的 Web 應用程式,則無法透過相同網頁伺服器上主機命名型網站集合建立多個 Web 應用程式。You can create a web application that does not have a host header. If you create a web application that does not have a host header, you cannot create multiple web applications with host-named site collections on the same web server.

為主機命名型網站集合建立多個 Web 應用程式的處理程序包含下列工作:The process that creates multiple web applications for a host-named site collections includes the following tasks:

  • 建立多個 Web 應用程式。Create the multiple web applications.

  • 在陣列伺服器中的每一部網頁伺服器的 IIS 中新增虛擬 IP 位址。Add a new virtual IP address in IIS on each web server in the farm.

為主機命名型網站集合建立多個 Web 應用程式Create multiple web applications for host-named site collections

以下範例建立 Web 應用程式:The following example creates a web application:

New-SPWebApplication -Name 'webapp' 'webapp.contoso.com' -port 80 -ApplicationPool ContosoAppPool -ApplicationPoolAccount (Get-SPManagedAccount 'Contoso\JDoe') -AuthenticationProvider (New-SPAuthenticationProvider -UseWindowsIntegratedAuthentication)

針對每一個 Web 應用程式重複此工作。Repeat this task for each web application.

在 IIS 中新增虛擬 IP 位址Add virtual IP addresses in IIS

IP 繫結必須套用在主控 Web 應用程式的所有伺服器上。將休眠命令設定為 60 秒,先確定伺服器陣列中的所有伺服器上已設定 IP 繫結,然後才可移除 Web 應用程式上的現有主機標頭。移除指令碼可用於此工作。The IP bindings must be applied on all servers that will host the web application. Set the sleep command to 60 seconds to make sure that the IP bindings are set to all servers in the farm before the existing host header on the web application is removed. Remote scripting can be used for this job.

使用下列命令,將唯一的 IP 繫結新增至您建立的每一個 Web 應用程式,然後將主機標頭繫結從這些 Web 應用程式中移除。Use the following commands to add unique IP bindings to each of the web applications that you created and then remove the host header binding from these web applications.

Import-Module WebAdministration
# add empty binding to webapp on IP 192.168.10.20
New-WebBinding -Name 'webapp' -IPAddress '192.168.10.20' -HostHeader '' 
Sleep 60
# remove existing binding webapp.contoso.com from existing web application
Get-WebBinding -Name 'webapp' -HostHeader 'webapp.contoso.com' | Remove-WebBinding

另請參閱See also

其他資源Other Resources

Get-spsiteurlGet-SPSiteUrl

Set-spsiteurlSet-SPSiteUrl

Remove-spsiteurlRemove-SPSiteUrl

規劃 SharePoint Server 的邏輯架構Plan logical architectures for SharePoint Server