CentOS Linux Server Guide

CentOS Web Server

 

Configuring Apache Web Server - Virtual Host

 

Virtual host in Apache web server means hosting mulitple web server or domain name in a single physical server.

 

By modifying NameVirtualHost directive, you can specify the IP address that will receive request using the name based virtual hosts

 

For example, we going to have 2 domain hosted under 1 ip 192.168.1.100. Where ServerName directive specify the hostname/domain and DocumentRoot is where we specify the location of domain's file.

 
vim /etc/httpd/conf/httpd.conf


Name VirtualHost 192.168.1.100
<VirtualHost 192.168.1.100>
   ServerName 1a-centosserver.com
   DocumentRoot /var/www/html/1a-centosserver/
</VirtualHost>

<VirtualHost 192.168.1.100>
  ServerName 101virtualization.com
  DocumentRoot /var/www/html/101virtualization/
</VirtualHost>

 

 

 

Back to CentOS Apache Web Server



Copyright 2011 http://www.1a-centosserver.com All Rights Reserved

All trademarks are the property of their respective owners.

Contact Us | Terms of Use | Privacy Policy