How to create a vhost in Apache2

This document applies to Ubuntu server with a base install of Apache2

Move into /etc/apache2/sites-available/
Edit a new file for the requested vhost domain (example.com.conf)

Add the following lines to into the newly created file

<VirtualHost example.com>
ServerAdmin webmaster@example.com
ServerAlias www.example.com
DocumentRoot /var/www/example.com
CustomLog /var/log/apache2/example.com-access.log combined
</VirtualHost>

Save and exit the file
Run the following command

a2ensite example.com.conf
/etc/init.d/apache2 restart


Article Details

Last Updated
26th of April, 2010

Related Articles

No related articles were found.

Attachments

No attachments were found.


User Opinions



How would you rate this answer?




Thank you for rating this answer.

© Copyright 2009 FireHost Inc. Privacy Policy Legal Information