Virtual host is a virtual environment over the top of your current web server to simulate a separate hosting environment. Using virtual host you can enable site specific features and keep your development environment totally separate from another one.
For tutorial you need to mod_rewrite enabled.
Step 1: setup hosts file
open /etc/hosts and add a virtual domain with a specific local IP.
Lets assume that our virtual domain name is “ruzdi.com” and It will listen to the ip “127.0.0.2″
so on /etc/hosts file we will add
Step2: configure virtual host with apache
Now goto /etc/apache2/sites-available and create a file named “r
sudo touch ruzdi sudo gedit /etc/apache2/sites-available/ruzdi
write the following contents inside. but please note to create the appropriate directory before linking your virtual host with that, for example we’ve create a folder named “/var/opt/ruzdi” and linked that directory as my document root in the following configuration file.
now create a symbolic link of this file to /etc/apache2/sites-enabled directory as “r
uzdi.com”sudo ln -s /etc/apache2/sites-available/ruzdi /etc/apache2/sites-enabled/ruzdi
**** here look directory location is /opt/ruzdi so you must create a directory named “ruzdi” on /opt location
Step 3: restart apache
simple, either one of the followingssudo a2ensite ruzdi
Andsudo /etc/init.d/apache2 restart
now on your browser to http:// r
***This is post is similar Hasin Hyder blog post I just change a little. In my case on the hosts file port was not working so I removed it and I got everything all right.