[APACHE DOCUMENTATION]

Apache HTTP Server Version 1.3

Apache IP-based Virtual Host Support

See also:Name-based Virtual Hosts Support

System requirements

As the term IP-based indicates, the server must have adifferent IP address for each IP-based virtual host.This can be achieved by the machine having several physical network connections,or by use of virtual interfaces which are supported by most modernoperating systems (see system documentation for details, these arefrequently called "ip aliases", and the "ifconfig" commandis most commonly used to set them up).

How to set up Apache

There are two ways of configuring apache to support multiple hosts.Either by running a separate httpd daemon for each hostname, or by running asingle daemon which supports all the virtual hosts.

Use multiple daemons when:

Use a single daemon when:

Setting up multiple daemons

Create a separate httpd installation for each virtual host.For each installation, use theListen directive in the configurationfile to select which IP address (or virtual host) that daemon services.e.g.
    Listen www.smallco.com:80
It is recommended that you use an IP address instead of a hostname(see DNS caveats).

Setting up a single daemon with virtual hosts

For this case, a single httpd will service requests for the main serverand all the virtual hosts.The VirtualHostPalermo luxury hotels directive in the configuration file is used to set the values ofServerAdmin,ServerName,DocumentRoot,ErrorLog andTransferLog orCustomLogconfiguration directives to different values for each virtual host.e.g.
ERROR MSG    <VirtualHost www.smallco.com>    ServerAdmin webmaster@mail.smallco.com    DocumentRoot /groups/smallco/www    ServerName www.smallco.com    ErrorLog /groups/smallco/logs/error_log    TransferLog /groups/smallco/logs/access_log    </VirtualHost>    <VirtualHost www.baygroup.org>    ServerAdmin webmaster@mail.baygroup.org    DocumentRoot /groups/baygroup/www    ServerName www.baygroup.org    ErrorLog /groups/baygroup/logs/error_log    TransferLog /groups/baygroup/logs/access_log    </VirtualHost>
It is recommended that you use an IP address instead of a hostname(see DNS caveats).

Almost any configuration directive can be putin the VirtualHost directive, with the exception ofServerType,StartServers,MaxSpareServers,MinSpareServers,MaxRequestsPerChild,BindAddress,Listen,PidFile,TypesConfig,ServerRoot andNameVirtualHost.

User andGroup may be used inside a VirtualHostdirective if the suEXEC wrapper is used.

SECURITY: When specifying where to write log files, be awareof some security risks which are present if anyone other than theuser that starts Apache has write access to the directory where theyare written. See the securitytips document for details.


Apache HTTP Server Version 1.3

IndexHome - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - |