Datasheet
“main” (Installation and Administration) — 2004/6/25 — 13:29 — page 549 — #575
i
i
i
i
i
i
i
i
22
The Apache Web Server
from /var/log/httpd to /var/log/apache2. A VirtualHost en-
try also must be configured for the domain originally hosted on the server
(www.mycompany.com). In this example, the original domain and one ad-
ditional domain (www.myothercompany.com) are hosted on the same
server.
Just as in NameVirtualHost, a * is used in the VirtualHost directives.
Apache uses the host field in the HTTP header to connect the request
with the virtual host. The request is forwarded to the virtual host whose
ServerName matches the host name specified in this field.
For the directives ErrorLog and CustomLog, the log files do not need to
contain the domain name. Here, use a name of your choice.
ServerAdmin designates the e-mail address of the responsible person that
can be contacted if problems arise. In the event of errors, Apache gives
this address in the error messages it sends to the client.
22.10.2 IP-Based Virtual Hosts
This alternative requires the setup of multiple IPs for a machine. In this
case, one instance of Apache hosts several domains, each of which is
assigned a different IP. The following example shows how Apache can
be configured to host the original IP (192.168.1.10) plus two addi-
tional domains on additional IPs (192.168.1.20 and 192.168.1.21).
This particular example only works on an intranet, as IPs ranging from
192.168.0.0 to 192.168.255.0 are not routed on the Internet.
Configuring IP Aliasing
For Apache to host multiple IPs, the underlying machine must accept re-
quests for multiple IPs. This is called multi-IP hosting. For this purpose, IP
aliasing must be activated in the kernel. This is the default setting in SUSE
LINUX.
Once the kernel has been configured for IP aliasing, the commands
ifconfig and route can be used to set up additional IPs on the host.
These commands must be executed as root. For the following example,
it is assumed that the host already has its own IP (such as 192.168.1.10),
which is assigned to the network device eth0.
Enter the command ifconfig to find out the IP of the host. Further IPs
can be added with commands such as the following:
/sbin/ifconfig eth0:0 192.168.1.20
/sbin/ifconfig eth0:1 192.168.1.21
549SUSE LINUX Enterprise Server










