Datasheet

“main” (Installation and Administration) 2004/6/25 13:29 page 550 #576
i
i
i
i
i
i
i
i
All these IPs will be assigned to the same physical network device (eth0).
Virtual Hosts with IPs
Once IP aliasing has been set up on the system or the host has been con-
figured with several network cards, Apache can be configured. Specify a
separate VirtualHost block for every virtual server:
<VirtualHost 192.168.1.20>
ServerName www.myothercompany.com
DocumentRoot /srv/www/htdocs/myothercompany.com
ServerAdmin webmaster@myothercompany.com
ErrorLog /var/log/httpd/www.myothercompany.com-error_log
CustomLog /var/log/httpd/www.myothercompany.com-access_log common
</VirtualHost>
<VirtualHost 192.168.1.21>
ServerName www.anothercompany.com
DocumentRoot /srv/www/htdocs/anothercompany.com
ServerAdmin webmaster@anothercompany.com
ErrorLog /var/log/httpd/www.anothercompany.com-error_log
CustomLog /var/log/httpd/www.anothercompany.com-access_log common
</VirtualHost>
VirtualHost directives are only specified for the additional domains. The
original domain (www.mycompany.com) is configured through its own
settings (under DocumentRoot, etc.) outside the VirtualHost blocks.
22.10.3 Multiple Instances of Apache
With the above methods for providing virtual hosts, administrators of one
domain can read the data of other domains. To segregate the individual
domains, start several instances of Apache, each with its own settings for
User, Group, and other directives in the configuration file.
In the configuration file, use the Listen directive to specify the IP handled
by the respective Apache instance. For the above example, the directive
for the first Apache instance would be:
Listen 192.168.1.10:80
For the other two instances:
Listen 192.168.1.20:80
Listen 192.168.1.21:80
550
22.10. Virtual Hosts