Home > Misc. Tutorial Logs > How-to create a virtual host in Apache (Ubuntu)

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

July 25, 2011 No Comments

Tags: apache domain linux virtual host

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 “domain.com” for your host and add this code:



ServerName domain.com
ServerAlias www.domain.com
ServerAdmin webmaster@localhost
DocumentRoot /home/user/domain.com/public_html/
ErrorLog /var/log/apache2/domain.com-error.log
# Possible values include: debug, info, notice, warn, error, crit, alert, emerg
LogLevel warn
CustomLog /var/log/apache2/domain.com-access.log combined

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

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>