Creating Virtual Host on Apache/Ubuntu

This days i am running for Zend Framework. Also feels a nice love for Linux. So i am trying to coup up with zend. Here i need to create a virtual host in my local environment. Ubuntu is my only OS. As i am newbee of linux and this is my first virtual host configuration, i need to google a lot and finally after some try, i got this easy 4 steps to run a minimal configured virtual host.

my /var/www folder is already routed to /home/tapan/www and i am using a zend folder to organize all my zend work. Also this is my quickstart for a zend framework to run over virtual host as well as practice other technique with standard manner. So finally my point of folder is

/home/tapan/www/zend/quickstart/public

Now follow this 4 steps to make virtual host.

Step 1 : Make a file in /etc/apache2/sites-available named as quickstart.conf and add the following line

<VirtualHost *:80>
ServerName quickstart
DocumentRoot /home/tapan/www/zend/quickstart/public
</VirtualHost>

Step 2 : Edit /etc/hosts and add your new domain to the 127.0.0.1 localhost line so it looks like this

127.0.0.1 localhost quickstart

Step 3 : Enable new virtual host quickstart

sudo a2ensite quickstart.conf

Step 4 : Restart apache to take effect of the new virtual host

sudo /etc/init.d/apache2 reload

Bingoo ! we are done. Now point your browser to quickstart to get the zend framework.

N.B. Also to disable virtual host need to use as follows,

a2dissite quickstart.conf

(Visited 2 times, 1 visits today)

Leave a comment

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