If you believe my posts will help someone please feel free to share.

The evolution of an Apache virtual host


The simplest virtual hosts

When an HTTP request comes into the IP address and Port 80, the Apache server will detect the hostname in the request and route the request to the directory declared in the DocumentRoot.

Adding www

It is still not uncommon for people to search for domains by adding www, for example http://butlerraines.com and http://www.butlerraines.com.

To make them both route to the same place we simply add a ServerAlias declaration in our virtualhost. Now when someone visits http://butlerraines.com or http://www.butlerraines.com they will be served the same files.

This is of course assuming you have set up your DNS to point www to your IP address.

Serving files from a user’s home directory.

Writing Apache error and access logs to a user’s home directory.