Virtual Servers
Although some Web sites, such as http://www.microsoft.com, can't be adequately serviced by one server, most Web sites are not accessed so frequently that one server can't address all their needs. In most cases Web sites get so little traffic that devoting an entire server to the Web site is a mistake. For most organizations that maintain multiple Web sites, using virtual servers is a way to maintain cost control.
Virtual servers work by having IIS determine which Web or FTP server is being referenced when the request comes in. This determination can be made by IP address (if the server has multiple IP addresses assigned to it), via TCP port, or in the case of Web servers by the hostname passed with the request.
The host header option that can be used with Web servers is unique because it enables you to use a single IP address and change the information returned by the name of the server the user specified in his Web browser. This is useful because prior to the introduction of the host header option, every Web site had to be on a separate IP address. The capability to use host headers has helped reduce the amount of IP addresses that must be allocated.
The way the HTTP (Web) protocol works is that the client sends a small packet of information to the Web server, which includes the capabilities of the browser and also the page the user requested that caused the request to be sent to the Web server.
The option to look at host headers to determine which Web site a user was referring to is a powerful thing. It enables multiple virtual Web servers to share the same IP address and TCP port; however, this comes at the cost of performance. Reading the HTTP header information the browser passes takes much more time than looking at the IP address or port. As a result, host headers should be used only when the traffic is very light and the additional overhead of looking into the host header won't over burden the server.
The best way to use virtual servers is to assign each one an IP address. This enables a single server to service multiple Web sites without concern for the user having to make any changes on his end and without the possibility that one site will return the information for another, as sometimes happens when using host headers.
Assigning Multiple IP Addresses
If you want to use separate IP addresses for each virtual site, the first step is to assign multiple IP addresses to the server. Step By Step 3.6 shows how to add additional IP addresses to a server.
STEP BY STEP 3.6: Specifying Additional IP Addresses
From the Start menu, select Settings, Network and Dial Up Connections.
Double-click the Local Area Network connection.
Select Properties from the Local Area Network Status dialog box.
Double-click Internet Protocol (TCP/IP).
-
Click the Advanced button. The Advanced TCP/IP Settings dialog box, as shown in Figure 3.7, is displayed.
Figure 3.7 Additional IP addresses are added from the Advanced TCP/IP Settings dialog box.
Click the Add button.
Enter an appropriate IP address and associated subnet mask.
Click the Add button when completed.
Click the OK button to close the Advanced TCP/IP Settings dialog box.
Click the OK button to close the Internet Protocol (TCP/IP) Properties dialog box.
Click the OK button to close the Local Area Connection Properties dialog box.
Don't Use DHCP
You can't assign multiple IP addresses to a computer via DHCPand it's a bad idea to use DHCP for a Web server anyway. You should allocate specific addresses for servers and manually assign an appropriate number to the server.
Now that you have multiple IP addresses assigned to your server, you can create Web sites that respond to different IP addresses.
Creating Virtual Web Servers
The process of creating a virtual Web server is as simple as following a few steps in a wizard. Step By Step 3.7 shows you how to create a new Web site.
STEP BY STEP 3.7: Adding a New Web Site
From the Start menu, select Settings, Control Panel.
Double-click Administrative tools and Internet Services Manager.
-
Click the plus sign to the left of the computer name to display a listing of Web and FTP sites, as shown in Figure 3.8.
Figure 3.8 A listing of Web and FTP sites.
Right-click the computer and select New, Web Site from the context menu.
Click the Next button to move past the introductory screen.
Enter a description for the Web site. For instance, if your Web site is to test Pocket Internet Explorer (pIE), you would enter pIE in the description.
-
Click the Next button to move to the IP Address and Port Settings dialog box, as shown in Figure 3.9.
Figure 3.9 Select the IP address, ports, and header.
Select the IP Address you want the Web site to respond to. By selecting the (All Unassigned) option, the Web site will respond to Web queries on any IP addresses that are not serviced by another Web site.
Select the TCP port for the Web server. The default is port 80. If you choose a port other than port 80, the user must manually specify the port when referring to the Web site. Using an alternative port number is often done for administrative Web sites. Ports are discussed in detail in the next section.
Select the host header, if any. This setting should be used only if you're going to service multiple Web sites on the same IP address and port. In that case, the host header needs to contain the name the user will use to refer to the site, such as http://www.thorprojects.com.
If you have an SSL certificate installed, you will be able to specify the SSL port for the Web site. The default is 423. As with the TCP port for normal traffic, if this is changed, the users will have to manually specify the port.
Click the Next button to move to the home directory step.
Select the path that will be the home directory for the Web site. Remember that all files located in this directory and below will be available via the Web.
Confirm that you want to allow anonymous access to this Web site. For most Web sites, except intranet and potentially extranet sites, this setting is appropriate.
Click the Next button to select the permissions.
Confirm that you want to allow read access to the Web site. In most cases, you will. This enables the Web server to return "static" HTML files and other types of files that are not processed on the server.
Confirm that you want to allow run scripts access to the Web site. This enables the Web site to run script-based programs. In practical terms, this means Active Server Pages (ASP).
Confirm that you do not want to allow execute access to the Web site; in most cases you will not want to allow execute access. Execute access is necessary only for ISAPI DLLs or CGIBIN applications. It is best to turn on this option for specific directories in a Web site rather than for the whole site, as is done here.
Confirm that you do not want to allow write access to the Web site. This option enables users to upload Web pages, scripts, and programs to the Web site. This is not recommended and is dangerous when run script or execute permission is also specified because it enables a user to upload and run code on the Web server.
Confirm that you do not want to allow browse access to the Web site. This option enables users to see a directory listing of a directory when no default document (HTML file, ASP script, or executable application) is found in the directory. This is useful for some subdirectories containing only files that you want the user to be able to read; however, it generally should not be set for an entire Web site.
Click the Next button and then the Finish button to complete the wizard.
Close the Internet Information Services window.
Use Unique Settings
If you specified settings for the Web site that put it in conflict with an already running Web site then the new Web site will be created but will initially be stopped. You must change the settings of the conflicting Web site or the one you just created to be able to start it. IIS creates default Web and FTP servers that you might need to stop to install your own virtual server.
The greatest challenge with creating new, virtual Web sites is ensuring that you specify unique criteria so IIS can determine which Web site is being referred to. If you do this through IP addresses, things are relatively straightforward. However, when done with host headers, it can sometimes be confusing as to which Web site will appear and which site will appear when no host header is specified. Older Web browsers might not provide a host header.
Creating Virtual FTP Servers
The process of creating virtual FTP servers is simpler than the process of creating virtual Web servers because FTP clients don't send host headers. Also, because of this, you have only two options you can choose to differentiate FTP servers: IP Address and Port. Step By Step 3.8 shows you how to create a new virtual FTP server.
STEP BY STEP 3.8: Adding a New FTP Site
From the Start menu select Settings, Control Panel.
Double-click Administrative Tools and Internet Services Manager.
-
Click the plus sign to the left of the computer name to display a listing of Web and FTP sites (refer to Figure 3.8).
Right-click the computer and select New, FTP Site from the context menu.
Click the Next button to move past the introductory screen.
Enter a description for the FTP sitefor instance, Thor Projects FTP Site.
Click the Next button to continue.
Select the IP address. As with Web sites, this should be how you differentiate one site from another. Selecting (All Unassigned) causes the site to respond to any IP address not assigned to another running FTP site using the same TCP port.
Enter the TCP port. This is the port on which requests will be received. The default is port 21. Note that FTP servers use a separate port for data transfers. This port can't be assigned because the client wouldn't understand receiving the data on a different port.
Click the Next button to continue.
Enter the path for the FTP site. As with Web sites, all files in the specified directory or any directory beneath it will be available from the FTP site.
Confirm read access. This is generally the access you want for an FTP site. You want to allow users to read (download) files from the server.
Confirm no write access. Generally, you don't want to allow users to upload to the FTP site.
Click the Next button, and then click Finish to complete the wizard.
Close the Internet Information Services window.
Creating a virtual FTP site is easier than creating a virtual Web site.