Windows Server 2003 Service Pack 1 includes Internet Information Services (IIS), Version 6.0, which makes it possible for you to host your own Web site on the Internet or your intranet.
IIS is an optional component of Windows Server 2003, is not enabled by default, and must be installed separately.
Who does this feature apply to?
This feature applies to the following audiences:
• IT professionals that use IIS to host and administer a Web site.
• Web developers that use IIS to develop Web content.
Internet Information Services 6 (IIS 6) is a powerful platform for hosting web sites on both the public Internet and on private intranets. Creating and configuring web sites and virtual directories are bread-and-butter tasks for IIS Administrators, and in this article we'll walk through the process of doing this using both the GUI (IIS Manager) and using various scripts included with Windows Server 2003. The seven specific tasks we'll walk through will include:
Creating a Web Site
Controlling Access to a Web Site
Configuring Web Site Logging
Configuring Web Site Redirection
Stopping and Starting Web Sites
For sake of interest, we'll explain these tasks in the context of a fictitious company called TestCorp as it deploys IIS for its corporate intranet.
Preliminary Steps
Unlike earlier versions of Microsoft Windows, IIS is not installed by default on Windows Server 2003. To install IIS, open Manage Your Server from the Start menu and add the Application Server role:
![](http://3.bp.blogspot.com/_vk9NbnBtwKo/S7ghyfd_4kI/AAAAAAAAADU/0N3vyr40uow/s320/image0021090326184492.jpg)
Note that for simple security reasons IIS should only be installed on member servers, not domain controllers. The reason is that if you install IIS on a domain controller and your web server becomes compromised, the attacker could gain access to your accounts database and wreak havoc with your network.
Creating a Web Site
The simplest approach is to use a separate IP address to identify each web site on your machine. Let's say our server has five IP addresses assigned to it from the range 172.16.11.220 through 172.16.11.224. Before we create a new Human Resources web site, let's first examine the identify of the Default Web Site. Open IIS Manager in Administrative Tools, select Web Sites in the console tree, and right-click on Default Web Site and open it's properties:
![](http://4.bp.blogspot.com/_vk9NbnBtwKo/S7giEc_0E9I/AAAAAAAAADc/7lfydekdvzM/s320/image0041090326205648.jpg)
The IP address for the Default Web Site is All Unassigned. This means any IP address not specifically assigned to another web site on the machine opens the Default Web Site instead. A typical use for the Default Web Site is to edit it's default document to display general information like a company logo and how to contact the Support Desk.
Let's use IP address 172.16.11.221 for the Human Resources site and make D:\HR the folder where the home page for this site is stored. To create the HR site, right-click on the Web Sites node and select New --> Web Site. This starts the Web Site Creation Wizard. Click Next and type a description for the site:
![](http://3.bp.blogspot.com/_vk9NbnBtwKo/S8AJg1RhwaI/AAAAAAAAAGU/Ewyi_dMa3tg/s320/image0061090326226070.jpg)
Click Next again and specify 172.16.11.221 as the IP address for the site:
![](http://4.bp.blogspot.com/_vk9NbnBtwKo/S7giuCsF0UI/AAAAAAAAADs/IepwuEbv-p0/s320/image0081090326249460.jpg)
Click Next and specify D:\HR as the home folder for the site. We've cleared the checkbox to deny anonymous access to the site because this is an internal intranet so only authenticated users should be able to access it (public web sites generally allow anonymous access):
![](http://1.bp.blogspot.com/_vk9NbnBtwKo/S7gjDDZ240I/AAAAAAAAAD8/V_mayWx6pAo/s320/image0101090326266429.jpg)
Click Next and leave only Read access enabled since the Human Resources site will initially only be used to inform employees of company policies:
![](http://3.bp.blogspot.com/_vk9NbnBtwKo/S7gjRjWazaI/AAAAAAAAAEE/ECsWVHcz-dA/s320/image0121090326290804.jpg)
Click Next and then Finish to create the new web site:
![](http://3.bp.blogspot.com/_vk9NbnBtwKo/S7gjde2z2sI/AAAAAAAAAEM/tTJGy3K1lr4/s320/image0141090326313913.jpg)
Now let's create another intranet site, this time for Help Desk, which will use IP address 172.16.11.222 and home folder D:\Help. We'll create this one using a script instead of the GUI:
![](http://3.bp.blogspot.com/_vk9NbnBtwKo/S7gj9zE1AWI/AAAAAAAAAEU/jzaxwPPE5Tg/s320/image0161090326337648.jpg)
And here's the result:
![](http://4.bp.blogspot.com/_vk9NbnBtwKo/S7gkKwVGhbI/AAAAAAAAAEc/KAhlivG3D0g/s320/image0181090326357320.jpg)
The script we used here is Iisweb.vbs, one of several IIS administration scripts available when you install IIS on Windows Server 2003. Note that unlike the Web Site Creation Wizard used previously. you can't use this script create a web site with anonymous access disabled. So if you want to disable anonymous access you should do it by opening the properties sheet for the Help Desk site, selecting the Directory Security tab, and clicking the Edit button under Authentication and Access Control. This opens the Authentication Methods box where you can clear the checkbox to disable Anonymous Access and leave Windows Integrated Authentication as the only authentication method available for clients on your network:
![](http://2.bp.blogspot.com/_vk9NbnBtwKo/S8AJsDZr-sI/AAAAAAAAAGc/8NsCpob4kyk/s320/image0201090326393023.jpg)
Controlling Access to a Web Site
First let's look at how we can control access to our web sites. There are basically four ways you can do this: NTFS Permissions, web permissions, IP address restrictions, and authentication method. NTFS permissions is your front line of defense but it's a general subject that we can't cover in detail here. Web permissions are specified on the Home Directory tab of your web site's properties:
![](http://4.bp.blogspot.com/_vk9NbnBtwKo/S8AKHv4jHRI/AAAAAAAAAGs/6Ik9Q9emwVg/s320/image0381090327595992.jpg)
By default only Read permission is enabled, but you can also allow Write access so users can upload or modify files on your site.
Script source access so users can view the code in your scripts (generally not a good idea), or Directory browsing so users can view a list of files in your site (also not a good idea). Web permissions apply equally to all users trying to access your site, and they are applied before NTFS permissions are applied. So if Read web permission is denied but NTFS Read permission is allowed, users are denied access to the site.
IP address restrictions can be used to allow or deny access to your site by clients that have a specific IP address, have an IP address within a range of addresses, or have a specific DNS domain name. To configure this, select the Directory Security tab and click the Edit button under IP Address and Domain Name Restrictions. This opens the following dialog, which by default does not restrict access to your site:
![](http://4.bp.blogspot.com/_vk9NbnBtwKo/S7gl9dA0prI/AAAAAAAAAFM/_JiwBq1M0S0/s320/image0401090327614585.jpg)
The main thing to watch for here is that denying access based on domain name involves reverse DNS lookups each time clients try to connect to your web site, and this can significantly impact the performance of your site.
The final way of controlling access to your sites is to use the Authentication Methods dialog box we looked at previously:
![](http://4.bp.blogspot.com/_vk9NbnBtwKo/S7gmPcIMF9I/AAAAAAAAAFU/nQ9n_P6P5ko/s320/image0421090327643101.jpg)
In summary, the five authentication options displayed here are:
*Anonymous access. Used mainly for web sites on public (Internet) web servers.
*Integrated Windows authentication. Used mainly for web sites on a private intranet.
*Digest authentication. Challenge/response authentication scheme that only works with clients running Internet Explorer 5.0 or later.
*Basic authentication. Older authentication scheme that transmits passwords over the network in clear text, so use this only in conjunction with SSL.
*.NET Passport authentication. Allows users to use their .NET Passport for authentication.
Configuring Web Site Logging
Since web sites are prime targets for attackers, you probably want to log hits to your site to see who's visiting it. By default IIS 6 logs traffic to all content as can be seen on the bottom of the General tab of the properties for a web site or virtual directory:
![](http://2.bp.blogspot.com/_vk9NbnBtwKo/S7gme1gYNgI/AAAAAAAAAFc/6vwUic37khM/s320/image0441090327662617.jpg)
The default logging format is the W3C Extended Log File Format, and clicking Properties indicates new log files are created daily in the indicated directory. It's a good idea to specify that local time be used for logging traffic as this makes it easier to interpret the logs:
![](http://3.bp.blogspot.com/_vk9NbnBtwKo/S7gmw-x983I/AAAAAAAAAFk/v0dAMfCC7zw/s320/image0461090327708460.jpg)
Configuring Web Site Redirection
Sometimes you need to take your web site down for maintenance, and in such cases it's a good idea to redirect all client traffic directed to your site to an alternate site or page informing users what's going on. IIS lets you redirect a web site to a different file or folder on the same or another web site or even to an URL on the Internet. To configure redirection you use the Home Directory tab and choose the redirection option you want to use:
![](http://1.bp.blogspot.com/_vk9NbnBtwKo/S7gnC5O770I/AAAAAAAAAFs/ENmtTRVf_vk/s320/image0481090327752757.jpg)
Stopping and Starting Web Sites
Finally, if sites become available you may need to restart IIS to get them working again. Restarting IIS is a last resort as any users currently connected will be disconnected and any data stored in memory by IIS applications will be lost. You can restart IIS using IIS Manager by right-clicking on the server node:
![](http://1.bp.blogspot.com/_vk9NbnBtwKo/S7gnNQjd0jI/AAAAAAAAAF0/gRbIp4A4e6M/s320/image0501090327768632.jpg)
You can also do the same from the command-line using the Iisreset command:
![](http://3.bp.blogspot.com/_vk9NbnBtwKo/S7gnZc1zv1I/AAAAAAAAAF8/eKj2a3k7bNo/s320/image0521090327795742.jpg)
Type iisreset /? for the full syntax of this command. You can also start and stop individual web sites using IIS Manager or the Iisweb.vbs script. And you can stop or start individual IIS services using the net commands, for example net stop w3svc will stop the WWW services only.
Summary
In this article I've explained how to create and configure web sites on IIS 6. Most of what we've covered also applies to IIS 5 on Windows 2000 as well.