Network Administration: Apache Virtual Host Configuration

A virtual host is simply a website with its own domain name hosted by an Apache server. To configure a virtual host, including the default virtual host, you use the Virtual Hosts tab of the HTTP configuration tool.

image0.jpg

Select the virtual host in the Virtual Hosts list and click the Edit button. This brings up the Virtual Host Properties dialog box.

image1.jpg

From this dialog box, you can configure a variety of important settings for the virtual host:

  • Virtual Host Name: The name you use to refer to the virtual host. For the default virtual host, the default name is — drum roll, please — Default Virtual Host.

  • Document Root Directory: This is the file system location that contains the HTML documents for the website. The default is /var/www/html, but you can specify a different location if you want to store your HTML files somewhere else.

  • Webmaster E-Mail Address: Each virtual host can have its own Webmaster e-mail address. If you leave this option blank, the address specified for the main HTTP configuration is used.

  • Host Information: This section of the dialog box lets you specify what HTTP requests should be serviced by this virtual host. In most cases, you should leave this set to the default setting, Handle All Remaining Unhandled Requests.

You can use the other tabs of the Virtual Host Properties dialog box to configure additional options. For example, the Page Options tab lets you set the directory search list and custom error pages among other options:

image2.jpg

  • Directory Page Search List: This list specifies the default page for the website. The default page is displayed if the user doesn’t indicate a specific page to retrieve. Then, Apache looks for each of the pages listed in the Directory Page Search list and displays the first one it finds. You can use the Add, Edit, and Delete buttons to modify this list.

  • Error Pages: This list lets you change the default error pages that are displayed when an HTTP error occurs. The most common HTTP error, Not Found, happens when the user requests a page that doesn’t exist. If you want to create a custom error page to let the user know that the page doesn’t exist or that some other error has occurred, this is the place to do it.