Configuring multiple web sites |
Kentico CMS allows you to run multiple web sites from a single installation (code base) and database. All web sites run as a single web site in IIS. The following tutorial explains how to set up multiple web sites on Windows XP and Windows Server 2000/2003.
We will configure two web sites:
Configuring multiple sites in Kentico CMS (common for all operating systems)
This part is common for all operating systems.
Configuring multiple sites on Windows Server 2000/2003
Open Start -> Administrative tools -> Microsoft Internet Information Services (IIS) Manager, go to Web sites section and if the web site does not exist yet, create it.
Right-click Web sites and choose New -> Web site... The Web Site Creation Wizard starts. Enter the site descriptive name, such as mysite.com:
Click Next. Enter the Host header for this web site as mysite.com:
Click Next. Select the disk path where the root of your web site is placed. This must be the folder where web.config file is placed.
Click Next. In the next step, enable the Read and Run scripts boxes.
Click Next. The wizard is finished. Click Finish. Now we need to add the other domain name to the list of URLs hosted by this web site. Right-click the newly created web site and display web site properties. On the Web Site tab, click Advanced...
Now you need to add another host header value for your second domain:
Click the top Add... button and enter the appropriate values. The standard HTTP port is 80:
You need to repeat this also for www.* alternatives of your web site:
Click OK on all dialogs.
Please note: You may also need to configure the web site for ASP.NET 2.0 in web site Properties, on the ASP.NET tab:
Your new web site is now configured to host all incoming requests for domains mysite.com and mysite2.com (or other domains depending on your particular situation). You may need to ask your network administrator to redirect the domain in the DNS records to your web site.
If you do not own the domain, you can test it by modifying the C:\WINDOWS\system32\drivers\etc\hosts file in notepad and adding the following lines to the end of the file:
127.0.0.1 mysite.com 127.0.0.1 www.mysite.com 127.0.0.1 mysite2.com 127.0.0.1 www.mysite2.com
Save the file. Please note: these are client settings, which means they will work only if you use web browser on your server.
Now, when you go to http://www.mysite.com and to http://www.mysite2.com (or your own domain names), you should see two different web sites.
Configuring multiple sites on Windows Vista / Server 2008
Go to Start -> Control Panel -> Administrative tools -> Microsoft Internet Information Services (IIS) Manager. In the tree view, right click Sites and choose Add Web Site....
Enter the following details and click OK.
The site should now appear in the tree, under the Sites node. Right click the site and choose Edit bindings (or Bindings on Vista).
The site bindings dialog appears. Click Add....
Enter the domain name of your second web site (www.mysite2.com in this case) into the Host name field and click OK. Repeat this for both of the sites without the 'www.' prefix.
The result should look like the following screenshot.
Your new web site is now configured to host all incoming requests for domains mysite.com and mysite2.com (or other domains depending on your particular situation). You may need to ask your network administrator to redirect the domain in the DNS records to your web site.
If you do not own the domain, you can test it by modifying the C:\WINDOWS\system32\drivers\etc\hosts file in notepad and adding the following lines to the end of the file:
127.0.0.1 mysite.com 127.0.0.1 www.mysite.com 127.0.0.1 mysite2.com 127.0.0.1 www.mysite2.com
Save the file.
Please note: these are client settings, which means they will work only if you use web browser on your server.
Now, when you go to http://www.mysite.com and to http://www.mysite2.com (or your own domain names), you should see two different web sites.
Configuring mulitple sites on Windows XP
On Windows XP, the support of multiple sites and domains in IIS is limited, so we will use a single IIS web site and define "virtual" domains in our hosts file:
Open the c:\WINDOWS\system32\drivers\etc\hosts file in notepad and add the following lines to the end of the file:
127.0.0.1 mysite.com 127.0.0.1 www.mysite.com 127.0.0.1 mysite2.com 127.0.0.1 www.mysite2.com
Save the file. Please note: these are client settings, which means they will work only if you use web browser on your local computer.
Go to http://www.mysite.com or http://www.mysite.com/kenticocms (where kenticocms is the name of the virtual directory with Kentico CMS web site) and to http://www.mysite2.com. You should see two different web sites.
|