CHAPTER 6

Planning Your Content Directories and Virtual Servers

Configuring a Single Content Directory
Setting the Default Document and Directory Browsing
Creating Virtual Servers
Configuring Content Directories

On small Web sites, Web content files are usually contained under one directory tree. Larger Web sites often store HTML content files, Web applications, and databases in multiple directories on the same computer or on several computers in the network. To make the contents of directories that reside on other computers appear in your computer's Web site, you create virtual directories.

With Internet Information Server, you can also create virtual servers, which enable a single server to appear as several servers. You can associate each content directory with a specific virtual server.

This chapter explains how to:

- Set up a single content directory.

- Set up default documents and enable directory browsing.

- Create virtual servers.

- Set up home directories.

- Create virtual directories.

See Chapter 5, “Securing Your Site Against Intruders,” for more information about security and about using the Windows NT File System (NTFS) with your directories.

# Configuring a Single Content Directory

If your Hypertext Markup Language (HTML) content files are contained under one directory tree, all you need to do is copy them to the default World Wide Web (WWW) home directory (\InetPub\Wwwroot) or change the home directory to refer to the location containing your files. However, if your files reside in multiple directories, or even multiple computers on your network, you will need to create virtual directories to make those files available from your Web site.

# Setting the Default Document and Directory Browsing

If a remote user sends a request without a specific file name (for example, http://www.microsoft.com/), the WWW service will return the specified default document, if it exists in that directory. You can place a file with the specified default document file name in each directory.

If no default document is available, the WWW service will return an error, unless directory browsing is enabled. If directory browsing is enabled, a directory listing containing links to the files and folders in that directory will appear.

A default document can be included in all WWW directories. In the Directories property sheet for the WWW service, change the Default Document entry to the default file name you will use on your system. Often the default document is set to be an index file (Index.htm) for the contents of that directory (or of the entire Web site). The default file name used is Default.htm.

If the user does not specify a file for a particular directory, a hypertext file and directory listing will be returned.

Directory browsing on the WWW service is very similar to browsing in File Transfer Protocol (FTP). Directory browsing is useful if you have a lot of files that you want to share quickly without converting them to Hypertext Markup Language (HTML) format.

Note Virtual directories will not appear in directory listings (also called “directory browsing” for the WWW service). To access a virtual directory, users must know the virtual directory’s alias, and type the URL in the browser. For the WWW service, you can also create links in HTML pages. For the gopher service, you can create explicit links in tag files so that users can access virtual directories. For the FTP service, you can list virtual directories by using directory annotations.

# Creating Virtual Servers

By convention each domain name, such as www.company.com, represents an individual computer. However, it is possible to use a single computer and make it appear to be not only a primary server (for example, named www.company.com), but also servers for different departments of your company (for example, marketing.company.com, sales.company.com, and so on). You can create virtual servers for these departments with Microsoft Internet Information Server. You do not need a different computer for each domain name.

To do this, you must obtain Internet Protocol (IP) addresses from your Internet Service Provider (ISP) for the primary server and for each virtual server you want to create. For example, you assign the first IP address (10.212.56.184) in the Domain Name System (DNS) as www.company.com (your primary server), and assign C:\Wwwroot as its content home directory. You register the second IP address (10.212.56.185) in the DNS as marketing.company.com, and assign a different drive or directory as its content home directory. Thus, it appears to users on the Internet that there are two computers when in fact it is the same computer running one copy of the WWW service. If you create a home directory without specifying an IP address, that home directory will be used for all requests containing server IP addresses not specified in other home directories.

These multiple IP addresses can be assigned to multiple network adapter cards, or to a single card. You use the Network application in the Windows NT Control Panel to bind the additional IP addresses to your network adapter card.

After the IP address is assigned to the network adapter card, you must assign a home content directory to that IP address. In the Directories property sheet, select the Virtual Server box and enter its IP address. Virtual directories (directories that are not home directories) can also be restricted to one virtual server by assigning an IP address to them.

## Setting Up a Virtual Server

You set up a virtual server by using the Directories property sheet in Internet Service Manager.

1. To display property sheets in Internet Service Manager, double-click the WWW Service or the computer name.

2. Click the Directories tab.

3. Click the Add button.

4. In the Directory box of the Directory Properties dialog box, select a directory by clicking the Browse button.

5. Click Home Directory.

6. Select the Virtual Server check box.

7. Type the IP address for the virtual server.

This address, which is typically supplied by your Internet service provider, must be configured by using the Microsoft TCP/IP Properties dialog box (found in the Network application in the Windows NT Control Panel; click the Protocols tab, select TCP/IP Protocol, and click the Properties button).

8. Click OK.

## Specifying Directories with Virtual Servers

If you have assigned more than one IP address to your server, when you create a virtual directory you must specify which IP address has access to that directory. If no IP address is specified, that directory will be visible to all virtual servers.

Important The default directories created during setup do not specify an IP address. You may need to specify IP addresses for the default directories when you add virtual servers.

## Directory

To specify the fully qualified path for the directory to use for the selected virtual server, choose the Add button and type the path in the Directory box of the Directory Properties dialog box, or use the Browse button to pick the directory to use.

# Configuring Content Directories

If your site is complex, you can configure WWW service to publish from multiple directories by using Internet Service Manager. The Directories property sheet lists the content directories used by the WWW service.

Directory lists the physical location of the directory.
Alias is the path for information service users.
Address lists the IP address of virtual servers assigned to that directory.
Error indicates any error status.

To configure individual WWW service directories, in the Directories property sheet click the Add button or the Edit Properties button.

## Home Directory

Each of the Internet services publishes information stored in one or more directories. The administrator specifies these publishing directories on the Directories property sheet of Internet Service Manager. Adding a directory on this property sheet allows the respective service to make available to clients information stored in the specified directory, and all of its subdirectories. Directories not listed on this property sheet are not available to clients.

Every service must have a home directory. The home directory is the “root” directory for that service. A root directory does not have a name. By default, the home directory and all folders in it are available to users.

#### To change your home directory

1. In Internet Service Manager, double-click the service for which you want to change the home directory to display its property sheets.

2. Click the Directories tab.

3. In the Directory list, select the directory with the <home> alias.

4. Click Edit Properties.

5. In the Directory box, type the name of the new directory, or select a new directory by using the Browse button.

6. In the Access box, select the access that you want to give users who connect to that directory.

7. Click OK.

8. Click Apply and then click OK.

#### To add a directory

1. In Internet Service Manager, double-click the service for which you want to add a directory to display its property sheets.

2. Click the Directories tab.

3. Click Add.

4. In the Directory box, type the name of the new directory or select a new directory by using the Browse button.

5. In the Access box (if applicable), select the access you want to give users who connect to that directory.

6. Click OK.

7. Click Apply and then click OK.

#### To delete a directory

1. In Internet Service Manager, double-click the service for which you want to delete a directory to display its property sheets.

2. Click the Directories tab.

3. In the Directory list, select the directory you want to delete.

4. Click Remove.

5. Click Apply and then click OK.

Note Deleting a virtual directory does not delete the directory or files to which the virtual directory points.

One (or more, if multiple virtual directories are active) of the directories listed on the Directories property sheet is marked as a home directory (sometimes referred to as a root directory). The path used in a client request to refer to the home directory is a forward slash (/). When a client request contains a path of /, or does not specify the path to a resource, the Web server looks in the defined home directory for the resource. For example, all of the following URLs refer to the Web server’s home directory.

http://inetsrvr.microsoft.com

http://inetsrvr.microsoft.com/

http://inetsrvr.microsoft.com/content.htm

The action taken by the Web server for the first two URLs shown above depends on the settings of the Default Document and Directory Browsing options, specified on the Service property sheet of Internet Service Manager. For the third example, the HTML file Content.htm, located in the home directory, is sent to the client. If a file by that name does not exist in the home directory, the server returns an error to the client. Other directories are not searched for such a file.

When a client logs on to the FTP service, the service looks for a subdirectory under the specified home directory with the name of the user logging on. For anonymous FTP logons, the service looks for a directory called “anonymous” under the home directory. If such a directory exists, the user will start the session with it as the current directory. If such a directory is not found, the current directory will be the home directory.

Subdirectories of the home directory are accessible to clients. For example, if a WWW service is configured with a home directory of C:\Wwwroot, then the following URL:

http://inetsrvr.microsoft.com/data/content.htm

causes the Web server to look for a file by the name content.htm in the directory C:\Wwwroot\Data. If the Data subdirectory does not exist, or the file is not found in that directory, the server will return an error. The FTP service allows changing the current directory to subdirectories of the home directory (by using the cd command), and gopher selectors can refer to objects in subdirectories of the home directory.

## Virtual Directory

Each of the Internet services can publish from multiple directories. Each directory can be located on a local drive, or across the network, by specifying the directory with a Universal Naming Convention (UNC) name, and a user name and password to use for access permission. A virtual server can have one home directory and any number of other publishing directories. These other publishing directories are referred to as virtual directories.

To simplify client URL addresses, the services present the entire set of publishing directories to clients as a single directory tree. The home directory is the root of this “virtual” directory tree, and each virtual directory is addressed as if it were a subdirectory of the home directory. Actual subdirectories of the virtual directories are available to clients as well. The WWW service alone supports virtual servers; thus, the FTP and gopher services can have only one home directory.

Note Virtual directories will not appear in directory listings (also called “directory browsing” for the WWW service). To access a virtual directory users must know the virtual directory’s alias, and type the URL in the browser. For the WWW service, you can also create links in HTML pages. For the gopher service, you can create explicit links in tag files so that users can access virtual directories. For the FTP service, you can list virtual directories by using directory annotations.

When a virtual directory is defined in Internet Service Manager, an alias is associated with the virtual directory. The alias is the subdirectory name that will be used by clients to access information in the virtual directory. If alias names for virtual directories are not specified by the administrator, an alias name is generated automatically by Internet Service Manager.

For example, suppose an administrator defines two directories for the WWW service as follows:

C:\Wwwroot <home directory>

D:\Webdata Alias = data

If C:\Wwwroot contains the subdirectory C:\Wwwroot\Scripts\, and D:\Webdata contains the subdirectory D:\Webdata\Images\, the following URLs can be requested by a Web client:

http://inetsrvr.microsoft.com/schedule.htm

http://inetsrvr.microsoft.com/scripts/query1.htm

http://inetsrvr.microsoft.com/data/stocks.htm

http://inetsrvr.microsoft.com/data/images/graph1.htm

For another example, if you want to provide three different product catalogs, each catalog could be stored on a separate hard drive on the server www.company.com.

Virtual directories can be used to present three separate drives as three subdirectories.

To browsers, virtual directories appear as subdirectories of the “root” home directory. You must provide the name (alias) that browsers will use to specify that directory.

Note To browse virtual directories, the URL for the virtual directory must be specified. This can be done either by clicking a hypertext link containing the URL, or by typing the URL in the browser.

### Creating Virtual Directories

You can create an almost unlimited number of virtual directories for your service, although performance may suffer if you create too many of them.

#### To create a virtual directory

1. In Internet Service Manager, double-click the service for which you want to add a virtual directory to display its property sheets.

2. Click the Directories tab.

3. Click Add.

4. Click Browse to select a directory in the Directory box.

5. Click Virtual Directory, then type the name of the virtual directory in the Alias box.

6. Set the Access permissions.

7. Click OK.

8. Click Apply and then click OK.

Note Virtual directories will not appear in directory listings (also called “directory browsing” for the WWW service). To access a virtual directory, users must know the virtual directory’s alias and type the URL in the browser. For the WWW service, you can also create links in HTML pages. For the gopher service, you can create explicit links in tag files so that users can access virtual directories.

### Specifying Directories with Virtual Servers

If you have assigned more than one IP address to your server, when you create a directory you must specify which IP address has access to that directory. If no IP address is specified, that directory will be visible to all virtual servers.

Important The default directories created during setup do not specify an IP address. You may need to specify IP addresses for the default directories when you add virtual servers.

## Account Information

This entry applies only if the physical directory is listed by using a Universal Naming Convention (UNC) path, such as \\Research4\Public\Wwwfiles. Enter a user name and password with permission to use the network directory share.

## Access Check Boxes

Read must be selected for content directories.

For the FTP Service, Write must be selected for directories that will accept data from users. Assign Write access cautiously to prevent unauthorized users from placing malicious files on, or deleting information from, your computer.

For the WWW service, Execute must be selected for directories containing programs, scripts, and Internet Server API (ISAPI) applications. Also, ensure that any directory marked Execute is not also marked Read; this will prevent users from seeing your interactive content executable files.

For the WWW service, Require secure SSL channel must be selected to require encrypted communication for a directory. For more information on Secure Sockets Layer (SSL), see Chapter 5, “Securing Your Site Against Intruders.”

© 1996 by Microsoft Corporation. All rights reserved.