Kentico CMS 6.0 Developer's Guide

Configuring multiple websites

Configuring multiple websites

Previous topic Next topic Mail us feedback on this topic!  

Configuring multiple websites

Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic!  

Kentico CMS allows you to run multiple websites from a single installation (code base) and database. All websites run as a single website in IIS. The following tutorial explains how to set up multiple websites on Windows XP and Windows Server 2003.

 

We will configure two websites:

 

mysite.com

mysite2.com

 

Configuring multiple sites in Kentico CMS (common for all operating systems)

 

This part is common for all operating systems.

 

1.Create two websites in Site Manager -> Sites - you can either import your existing websites or you can create new websites using the New site wizard.

2.Edit the properties of each website in Site Manager -> Sites and set the Site domain name value of the each website to the appropriate domain (without www prefix and without http:// protocol).

3.Make sure both sites are running. You can check this in the Site list, in the Status column.

4.Make sure you have valid license keys for both domains in Site Manager -> Licenses.

 

devguide_clip0341

 

Configuring multiple sites on Windows Server 2003

 

Open Start -> Administrative tools -> Microsoft Internet Information Services (IIS) Manager, go to websites section and if the website does not exist yet, create it.

 

devguide_clip0874

 

Right-click websites and choose New -> website... The website Creation Wizard starts. Enter the site descriptive name, such as mysite.com:

 

devguide_clip0883

 

Click Next. Enter the Host header for this website as mysite.com:

 

devguide_clip1087

 

Click Next. Select the disk path where the root of your website is placed. This must be the folder where web.config file is placed.

 

devguide_clip1088

 

Click Next. In the next step, enable the Read and Run scripts boxes.

 

devguide_clip1089

 

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 website. Right-click the newly created website and display website properties. On the website tab, click Advanced...

 

devguide_clip1090

 

Now you need to add another host header value for your second domain:

 

devguide_clip1091

 

Click the top Add... button and enter the appropriate values. The standard HTTP port is 80:

 

devguide_clip1092

 

You need to repeat this also for www.* alternatives of your website:

 

devguide_clip1093

 

Click OK on all dialogs.

 

Please note: You may also need to configure the website for ASP.NET 2.0 in website Properties, on the ASP.NET tab. IIS 6 may display the ASP.NET version as 2.0.50727 even if you have ASP.NET 3.5 or higher installed and registered:

 

devguide_clip1094

 

Your new website 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 website.

 

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 websites.

 

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 website....

 

devguide_clip1095

 

Enter the following details:

 

Site name: mysite.com

Physical path: disk path to the location where your website is placed; this must be the location where the web.config file is stored

Host name: www.mysite.com

 

Click OK.

 

devguide_clip1096

 

The site should now appear in the tree, under the Sites node. Right click the site and choose Edit bindings (or Bindings on Vista).

 

devguide_clip1097

 

The site bindings dialog appears. Click Add....

 

devguide_clip1098

 

Enter the domain name of your second website (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.

 

devguide_clip1099

 

The result should look like the following screenshot.

 

devguide_clip1100

 

Your new website 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 website.

 

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 websites.

 

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 website 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 website) and to http://www.mysite2.com. You should see two different websites.

 

 

 

Multiple websites on a single domain (in subfolders)

 

If you cannot use (for some reason) multiple domain names, you can configure Kentico CMS so that it differentiates websites by subfolder (virtual directory). Read chapter Multiple websites on a single domain (in subfolders) for more details.

 

 

 

Using multiple websites on Windows XP

 

Windows XP allows you to run only one IIS website at a time. If you need to develop multiple websites (multiple Kentico CMS instances) in the root folder, you may need to create additional websites and switch between them using the IISAdmin utility that can be downloaded at http://jetstat.com/iisadmin/download.asp.