VirtualHost

From KlavoWiki
Revision as of 02:09, 21 November 2010 by David (Sọ̀rọ̀ | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

http://httpd.apache.org/docs/2.2/vhosts/


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.

/etc/httpd/conf/httpd.conf

NameVirtualHost *:80
<VirtualHost *:80>
    ServerName dummy-host.example.com
    DocumentRoot /www/docs/dummy-host.example.com
</VirtualHost>

Addational paramaters

    ServerAlias domain.tld *.domain.tld 
    ServerAdmin webmaster@dummy-host.example.com
    ErrorLog logs/dummy-host.example.com-error_log
    CustomLog logs/dummy-host.example.com-access_log common