DNS

Creating a Virtualhost for Apache 2.X

Submitted by Will Jackson on Fri, 06/22/2012 - 6:13pm

Name-based virtual hosting allows for hosting multiple websites with different domains and subdomains on a single server.  To configure a web server for name-based virtual hosting, you will need to add a virtualhost configuration and for this example I am using Apache2.  This tutorial was tested against Debian 6 Squeeze, but should be applicable for most linux operating systems.  For this example we will use the nano as a command line editor, but you could use vi, gedit, or any other preferred editor.  Also for the example, I will use sub.example.com as a placeholder, which will need to be modified to reflect the domain name or subdomain that you intend to use for your virtualhost.  The domain chosen in the example is for a subdomain, but by simply dropping the prefix of “sub.” the virtualhost will instead then be valid for the primary domain of “example.com”.

Subscribe to RSS - DNS