Two Copies of Apache
To
illustrate the possibilities, we will run two copies of Apache with
different IP addresses on different consoles, as if they were on two
completely separate machines. This is not something you want to do
often, but on a heavily loaded site it may be useful to run two
Apaches optimized in different ways. The different virtual hosts
probably need very different configurations, such as different values
for ServerType
, User
,
TypesConfig
, or ServerRoot
(none of these directives can apply to a virtual host, since they are
global to all servers, which is why you have to run two copies to get
the desired effect). If you are expecting a lot of hits, you should
avoid running more than one copy, as doing so will generally load the
machine more.
You can find the necessary machinery in ... /site.twocopy. There are two subdirectories: customers and sales.
The Config file in ... /customers contains the following:
User webuser Group webgroup ServerName www.butterthlies.com DocumentRoot /usr/www/APACHE3/APACHE3/site.twocopy/customers/htdocs BindAddress www.butterthlies.com TransferLog logs/access_log
In .../sales the Config file is as follows:
User webuser Group webgroup ServerName sales.butterthlies.com DocumentRoot /usr/www/APACHE3/APACHE3/site.twocopy/sales/htdocs Listen sales-not-vh.butterthlies.com:80 TransferLog logs/access_log
On this occasion, we will exercise the sales-not-vh.butterthlies.com URL. For the first time, we have more than one copy of Apache running, and we have to associate requests on specific URLs with different copies of the server. There are three more directives to for making these associations:
Get Apache: The Definitive Guide, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.