Pick a Free OS

User login

Navigation

Web server tutorial - Part 3

(no cacheing without CacheRoot)

CacheRoot "/var/cache/httpd"

CacheSize 5

CacheGcInterval 4

CacheMaxExpire 24

CacheLastModifiedFactor 0.1

CacheDefaultExpire 1

NoCache a_domain.com another_domain.edu joes.garage_sale.com

</IfModule>

Section 3: Virtual hosts

VirtualHost: If you want to maintain multiple domains/hostnames on your machine you can setup VirtualHost containers for them. Please see the documentation here for further details before you try to setup virtual hosts. You may use the command line option '-S' to verify your virtual host configuration.


If you want to use name-based virtual hosts, you need to define at least one IP address (and port number) for them.

NameVirtualHost 12.34.56.78:80

NameVirtualHost 12.34.56.78

NameVirtualHost 192.192.192.1

VirtualHost example

Almost any Apache directive may go into a VirtualHost container.


<VirtualHost ip.address.of.host.some_domain.com>

ServerAdmin webmaster@host.some_domain.com

DocumentRoot /www/docs/host.some_domain.com

ServerName host.some_domain.com

ErrorLog logs/host.some_domain.com-error_log

CustomLog logs/host.some_domain.com-access_log common

</VirtualHost>

<VirtualHost default:*>

</VirtualHost>

<VirtualHost 192.192.192.1>

ServerAdmin amby@goldie.com

DocumentRoot /docfile

ServerName www.goldie.com

ErrorLog logs/err

</VirtualHost>


<VirtualHost 192.192.192.57>

ServerAdmin amby@failure.com

DocumentRoot /htdoc

ServerName www.failure.com

ErrorLog /home/err

</VirtualHost>

<VirtualHost 192.192.192.90>

ServerName www.chiku.com

DocumentRoot /home/chinu/public_html

</VirtualHost>


<VirtualHost 192.192.192.91>

ServerName www.chik.com

DocumentRoot /home/

</VirtualHost>