There are many different ways you can configure Apache2 to host multiple sites. Here we’re only going to cover the basics with the use of the NameVirtualHost directive.
The advantage of this approach is that you don’t need to hard-wire any IP addresses, and it will just work. The only thing you need is for your domain names to resolve to the IP address of your webserver.
For example if you have an Apache2 server running upon the IP address 192.168.4.1 and you wish to host the three sites example.com, example.net, and example.org you’ll need to make sure that these names resolve to the IP address of your server.
Since we’ll be hosting multiple websites on the same host it makes a lot of sense to be very clear on the location of each sites files upon the filesystem. The way I suggest you manage this is to create a completely seperate document root and logfile directory for each host. You can place these beneath the standard Debian prefix of /var/www or you may use a completely different root.
Step 1. If you’ve not already done create the directories to contain your content, etc, as follows:
Deb:~# mkdir /var/www/www.example.com
Deb:~# mkdir /var/www/www.example.net
Deb:~# mkdir /var/www/www.example.org