BLOG

A LITTLE STORY ABOUT MY JOURNEY

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:

[code]
<VirtualHost *:80>
ServerAdmin kishor@amplecube.com
DocumentRoot "/srv/www/cakephp"
ServerName cakephp.loc
ServerAlias www.cakephp.loc

</VirtualHost>

[/code]

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:

127.0.0.1          localhost

127.0.0.1         mysite.com.loc

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 (mysite.com.loc)

enjoy your self

441 Total Views 1 Views Today