Creating Virtual Host on ubuntu server or windows system

Virtual hosting is a method for hosting multiple domain names (with separate handling of each name) on a single server (or pool of servers). This allows one server to share its resources, such as memory and processor cycles, without requiring all services provided to use the same host name. The term virtual hosting is usually used in reference to web servers but the principles carry over to other internet services.

More detail:

Must of time we need to crate virtual host: some steps to create virtual host on Linux system(Ubunutu)

1. First crate your own file or copy default file with your own site name

[code] cp /etc/apache2/sites-available/default /etc/apache2/sites-available/mysite [/code]

2. Now add some code or replace these code with:

<VirtualHost *:80>
DocumentRoot "/srv/www/cakephp"
ServerName cakephp.loc
ServerAlias www.cakephp.loc



3. Enable this file or site with virtual by this command :

[code] sudo a2enssite /etc/apache2/sites-availabel/mysite [/code]

4.  Assign ip address with localhost and your sitename: in /etc/hosts file Like:          localhost

5 . Restart your server by command :

[code] sudo serveice apache2 reload  or sudo /etc/apache2/init.d apache2 restart [/code]

Now open your site url (

enjoy your self

558 Total Views 1 Views Today