Internet Information Services, ususally simply referred to as IIS, is the web server developed by Microsoft and shipped with most versions of the Microsoft Windows operating system. These pages provide some basic information to help you get started quickly with IIS.
While present on most Windows version, IIS is disabled by default. The following paragraphs show how to enable it and setup a basic Hello World! website.
IIS 8 on Windows 8
Windows 8 ships with IIS 8. To enable it go to the control panel, then go to the "Programs" section and click on the "Turn Windows features on or off" option in the "Programs and Features" section. This will launch the screen shown in figure 1.
|Figure 1: The screen to enable/disable IIS features|
The relevant branch in the tree of features to configure IIS is the "Internet Information Services" branch which we have expanded in figure 1 above. You can see that by default none of the IIS features are enabled. For the purpose of this example we will enable the minimum set of components needed. For that we have checked the "Static Content" feature as shown in figure 2. We also need the "IIS Management Console" else we'd have no way to configure our website. With these features we can setup a simple website that serves static web pages. Figure 2 shows the feature tree with the two desired features selected.
|Figure 2: The screen to enable/disable IIS features|
Now that we have selected the features we want to install we press "OK" to save our choices. Windows will start installing the features. Figure 3 shows the message displayed after successful installation.
|Figure 3: Successful feature installation message|
Now that we have enabled the IIS Management Console the "Internet Information Services" icon can be found in the Windows 8 Start screen as shown in figure 4 (in the upper right corner).
Clicking on this icon brings up the IIS Manager screen shown in figure 5. VM-WINDOWS8 is the name of the computer on which the example was developed. You can see in the left-hand column called "Connections" that a default website has already been set up (and actually also already started). For the moment we won't discuss the contents of the center column. The right-hand column is simply a list of shortcuts to common operations that changes depending on what is currently selected.
|Figure 5: The IIS Manager screen|
Let's now go to the default website by selecting the "Default Web Site" branch in the "Sites" sub-tree in the "Connections" column. This brings up the screen shown in figure 6.
|Figure 6: The IIS Manager screen|
You may be tempted to click on the "Browse" action in the right-hand column. This will not work however because we have enabled such a limited set of features that it breaks this "Browse" functionality. It relies on the "Default Document" feature but we will discuss this soon so for the moment just keep in mind this action isn't working.
While we can't use the "Browse" action for the default website we can simply open it from a web browser. If you go to a browser and type in the following URL: http://localhost/iisstart.htm, the IIS 8 default website page will be displayed. It looks like the one displayed in figure 7 (that screen tends to change with each version of IIS though). Note that you have to type the full URL, omitting the iistart.htm part won't work. We will discuss how to associate domain names with a website later on (on Page 4). For now we'll just access it using localhost.
It would also be usual to specify 127.0.0.1 instead of localhost but be aware that on Windows 8.1 with Internet Explorer 11 a feature called "Enhanced Protected Mode" is enabled by default and that will prevent you from accessing 127.0.0.1. You can disable the feature or simply use another browser if you need to refer to your site using 127.0.0.1. The feature is discussed in details in this MSDN blog. Instructions on how to disable it can be found here.
|Figure 7: The IIS default website page|
As we said earlier we can't omit the iisstart.htm part in the URL but it is usually possible to visit a website by just typing the domain part of the URL and the server will usually display a page called index.htm or index.html. It doesn't work in our case because we haven't enabled the necessary feature when we enabled IIS. On figure 2 you can see a feature called "Default Document" in the "Common HTTP Features" section. It is obviously a good idea to enable it and the only reason we haven't done so is to show the effect of the different features that can be enabled or disabled. So let's go back to the screen in figure 2 and enable the "Default Document" feature, then restart the IIS Manager. The screen should now look like the one in figure 8. You can see a new icon called "Default Document".
|Figure 8: The IIS Manager screen after we enable the Default Document feature|
If we click on the "Default Document" icon we get the screen shown in figure 9. The configuration for the default document is simply a list of filenames to search for on the filesystem. The search will start with the first item in the list. To avoid unnecessary search attempts it is a good idea to only leave in the list the defaults you will actually use for your website. Since iisstart.htm is in the list we can now access the default website by entering the http://localhost/ URL in a browser. We can also now use the "Browse" action in the right-hand side column since it is simply a shortcut for launching the browserr and entering the http://localhost/ URL.
|Figure 9: Default Document setting|
The contents of the default website are stored in the C:\inetpub\wwwroot directory in a default IIS installation. You can easily get to the directory where the contents of a site are stored by right-clicking on the site in the IIS Manager in the "Connections" column and select "Explore" as shown in figure 10.
|Figure 10: Exploring website contents on the file system|
For the default website the contents are shown in figure 11. As mentioned earlier the default page tends to change with each IIS version so the contents may be different than what is shown here.
|Figure 11: Directory where the files are stored on disk|
Now we can easily replace the default contents with our own home page. We delete the current contents of the directory and replace them with a single index.html file.File: index.html
<html> <head><title>Welcome</title></head> <body> <p>Hello World!</p> </body> </html>
If you browse to http://localhost you will now see "Hello World!" displayed as shown in figure 12. You may have to refresh the page if it still display the old contents.
|Figure 12: Default website contents replaced by Hello World!|
This concludes this part of our tutorial. In the next section we'll discuss how to enable logging.
blog comments powered by Disqus