Aug 02
Apache VirtualHost on Ubuntu
Here’s a quickie tutorial on how to add Virtual Hosts to Apache on Ubuntu. This tutorial assumes that you have a basic understanding of Apache configuration and that your Apache is installed and able to serve websites.
- cd /etc/apache2/sites-available
- sudo vim yourdomain.com.conf and enter your VirtualHost directive. Below I’ve put the most basic example, see Apache docs for details and additional features:
<VirtualHost *>
ServerName yourdomain.com
DocumentRoot /home/youruser/public_html
</VirtualHost>Save & exit.
- sudo vim /etc/hosts and add your new domain to the 127.0.0.1 locahost line so it looks like this:
127.0.0.1 localhost yourdomain.com
Save & exit.
- Enable your new virtualhost:
sudo a2ensite yourdomain.com.conf
- Reload the Apache configuration:
sudo /etc/init.d/apache2 reload
That’s it! Repeat for each of your VirtualHosts.
—————-
Now playing: Alèmayèhu Eshèté – Tchero Adari Nègn
via FoxyTunes

March 29th, 2009 at 4:36 pm
Great and easy tutorial! Thanks a lot. But for virtual host to work, I needed to add “” instead of “”.
March 29th, 2009 at 4:39 pm
Ups – something went wrong in previous post. OK, again – I replaced * with *:80 to make it work.
August 22nd, 2009 at 4:49 pm
Good tutorial!
Simple and direct!!
Trank’s
December 22nd, 2009 at 7:01 am
[...] Apache VirtualHost on Ubuntu | Tequila Fish (tags: ubuntu dns virtualhost) [...]