How to set up Apache virtual hosting

Filed under
HowTos

Managing one site on a Web server can be tough enough, and the job is even harder if you have to host multiple client sites on a badly configured setup. If you're running Apache, you can make things easier by setting up virtual hosts, which let you control multiple domains on one IP address, allowing you to specify URLs like http://clientsdomain.com/file_name.html instead of http://yoursite.com/hosted/clients_directory/file_name.html, and letting you forgo setting up domain forwarding with a /srv/www/htdocs/hosted/clients_directory/ file.

If Apache is installed correctly, you can set up virtual hosting easily by editing Apache configuration files. The main .conf files in /etc/apache2 include httpd.conf, error.conf, server-tuning.conf, and a bunch more. These files are set for read-only access for normal users; you must gain root access with the sudo or su command to change them.

More Here