The Apache HTTP Server commonly referred to as Apache, is web server software notable for playing a key role in the initial growth of the World Wide Web. In 2009 it became the first web server software to surpass the 100 million website milestone. Apache was the first viable alternative to the Netscape Communications Corporation web server (currently named Oracle iPlanet Web Server), and since has evolved to rival other web servers in terms of functionality and performance. Typically Apache is run on a Unix-like operating system.
What is Virtual Hosting on Apache2?
The term Virtual Host refers to the practice of running more than one web site (such as www.company1.com and www.company2.com) on a single machine. Virtual hosts can be “IP-based”, meaning that you have a different IP address for every web site, or “name-based”, meaning that you have multiple names running on each IP address. The fact that they are running on the same physical server is not apparent to the end user.
Apache was one of the first servers to support IP-based virtual hosts. Versions 1.1 and later of Apache support both IP-based and name-based virtual hosts (vhosts). The latter variant of virtual hosts is sometimes also called host-based or non-IP virtual hosts.
Steps by Steps How to Configure – Virtual Hosting using Apach2 on Ubuntu 11.10 Oneiric
First, create a file in the /etc/apache2/sites-available/ directory for each virtual host that you want to set up. Name each file with the domain for which you want to provide virtual hosting. See the following example configurations for the hypothetical "example.com" and "example.org" domains. Substitute your own domain names for those shown below.
mujib@mujib-desktop:/etc/apache2/sites-available$sudo vi v-hosts
then write the following text:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName test.mr
DocumentRoot /var/www/testwp
</VirtualHost>
Save & quit.
This command symbolically links your virtual host file from sites-available to the sites-enabled directory. Finally, before you can access your sites you must reload Apache with the following command:
mujib@mujib-desktop:/etc/apache2/sites-available$ sudo a2ensite v-hosts
mujib@mujib-desktop:/etc/apache2/sites-available$ sudo /etc/init.d/apache2 reload
mujib@mujib-desktop:/etc/apache2/sites-available$ sudo vi /etc/hosts
127.0.0.1 test.mr
Restart the Apache server.
mujib@mujib-desktop:/etc/apache2/sites-available$ sudo /etc/init.d/apache2 restart
Thats all. :)
What is Virtual Hosting on Apache2?
The term Virtual Host refers to the practice of running more than one web site (such as www.company1.com and www.company2.com) on a single machine. Virtual hosts can be “IP-based”, meaning that you have a different IP address for every web site, or “name-based”, meaning that you have multiple names running on each IP address. The fact that they are running on the same physical server is not apparent to the end user.
Apache was one of the first servers to support IP-based virtual hosts. Versions 1.1 and later of Apache support both IP-based and name-based virtual hosts (vhosts). The latter variant of virtual hosts is sometimes also called host-based or non-IP virtual hosts.
Steps by Steps How to Configure – Virtual Hosting using Apach2 on Ubuntu 11.10 Oneiric
First, create a file in the /etc/apache2/sites-available/ directory for each virtual host that you want to set up. Name each file with the domain for which you want to provide virtual hosting. See the following example configurations for the hypothetical "example.com" and "example.org" domains. Substitute your own domain names for those shown below.
mujib@mujib-desktop:/etc/apache2/sites-available$sudo vi v-hosts
then write the following text:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName test.mr
DocumentRoot /var/www/testwp
</VirtualHost>
Save & quit.
This command symbolically links your virtual host file from sites-available to the sites-enabled directory. Finally, before you can access your sites you must reload Apache with the following command:
mujib@mujib-desktop:/etc/apache2/sites-available$ sudo a2ensite v-hosts
mujib@mujib-desktop:/etc/apache2/sites-available$ sudo /etc/init.d/apache2 reload
mujib@mujib-desktop:/etc/apache2/sites-available$ sudo vi /etc/hosts
127.0.0.1 test.mr
Restart the Apache server.
mujib@mujib-desktop:/etc/apache2/sites-available$ sudo /etc/init.d/apache2 restart
Thats all. :)
No comments:
Post a Comment