Host Sitefinity CMS on a separate IIS server for local development
Overview
This article explains how to host Sitefinity CMS on an IIS instance and make it accessible to the .Net Core Renderer application. You can use this setup for local development purposes.
PREREQUISITES: You must have hosted your Sitefinity CMS application on an IIS instance. For more information, see Run projects on IIS.
After you have hosted your Sitefinity CMS on an IIS, depending on the port setup, you can do the following:
Scenario 1: Sitefinity CMS listens to unique port
When Sitefinity CMS is the only running application that listens to a specific port, such as 80 or 433, you can configure the Renderer application in one of the following ways:
- In the
appsettings.json
file of the Renderer, modify the URL to be the IP address of the machine that hosts the Sitefinity CMS.
- Add a binding in your hosts file that has a custom domain pointing to the IP address of the machine that hosts the Sitefinity CMS. Afterwards, use this binding in the
appsettings.json
file of the Renderer application.
Scenario 2: Sitefinity CMS shares a port
When Sitefinity CMS is hosted alongside other applications on the same port, the applications are differentiated by their domain names.
NOTE: The following procedure assume that Sitefinity CMS is hosted with domain name mysitefinity.com, under the default ports – 80 and 443.
- Open the
web.config
file of your Sitefinity CMS.
- Inside the
<system.webServer>
config element, add the following rewrite rule:
- Save and close the web.config.
- In the IIS, allow the
HTTP_HOST
server variable on the Sitefinity CMS application in the following way:
- In the Sites dropdown, select the Sitefinity CMS application.
- Under HTTP Features, click URL Rewrite.
- In the right sidebar, click View Server Variables » Add.
- For the name of the variable, enter HTTP_HOST and click OK.
It appears in the list of allowed variables with Entry Type set to Local.
- Open the
appSettings.json
of the .NET Core Renderer application.
- In the
Sitefinity
object, add the property "HostHeaderName": "X-Original-Host"
- Update the URL property to mysitefinity.com
- Save and close the
appSettings.json
.
NOTE: You can add a binding in your hosts file to the same domain - mysitefinity.com.
The binding must point to the IP Address of your IIS instance. Then, you use that binding in the appsettings.json
file of the Renderer.