How-to create a virtual host in Apache (Ubuntu)

You will find on most Linux based web hosts a directory which is called “sites-available” (inside /etc/httpd/ or /etc/apache2/). Create a configuration file with the name “” for your host and add this code:

ServerAdmin webmaster@localhost
DocumentRoot /home/user/
ErrorLog /var/log/apache2/
# Possible values include: debug, info, notice, warn, error, crit, alert, emerg
LogLevel warn
CustomLog /var/log/apache2/ combined

Create the directory for your web host and activate the host with a2ensite and reload your apache engine.