| Company |
URL |
| company1 |
http://www.isp.com/company1/ |
| company2 |
http://www.isp.com/company2/ |
Each customer organization prefers that
their home page appear under their own domain name rather
than as a branch of the ISP's server domain name. But,
the customer organizations do not want to set up their
own internet links and servers. The ISP can define their
server as a virtual host, which allows company1 and
company2 to each have their own Internet name registrations,
www.company1.com and www.company2.org, respectively.
These names both correspond to the ISP's server (www.isp.com).
The home pages might now appear as shown in Table 1-2.
Table 1-2: Example Home Pages
for a Virtual Host Server
| Company |
URL |
| company1 |
http://www.company1.com/ |
| company2 |
http://www.company2.org/ |
There are two methods you can use to
establish your server as a virtual web host. You can
configure your web server to use a single instance of
the web server and a single IP address, but map the
IP address to multiple domain names. Under Apache, the
resulting configuration is called a non-IP intensive
virtual server.
Alternatively, you can configure your
web host to use an instance of the web server and an
IP address for each domain name. Under Apache, the resulting
configuration is called an IP intensive, or multiple
IP, virtual server.
The non-IP intensive method results
in multiple domain names that link to the same server
instance within the same Web server. The IP intensive
method results in multiple virtual server instances
linked to the same Web server, with each virtual server
instance linked to a particular IP address. When this
document discusses a server instance, it refers to a
new server configuration under a currently installed
Web server.
This document describes the differences
between IP and non-IP intensive virtual servers and
the pros and cons of each implementation. The document
also describes how to configure Apache to implement
both types of virtual server.
Most of the information on Apache's
implementation of virtual web hosts, including the configuration
instructions, comes from the Apache
home page. See that page for complete descriptions
of all Apache implementations and configuration directives.
Return to Table
of Contents
Single IP Address
When you configure your web server as
a virtual server using the single IP address method,
you establish a single IP address and hostname for that
single instance of the web server. For each customer
domain name, you map an IP hostname alias to the IP
address already associated with the server.
To map an IP hostname alias to the server's
IP address, you create canonical name, or CNAME, entries
in your DNS (Domain Name System) server for each domain
name. For example, if you have a web server defined
as www.isp.com, you can configure DNS with multiple
CNAME entries that point to www.isp.com. In this way,
www.customer1.com, www.customer2.com and other customer
domain names can share your ISP server, while each has
a unique home page and unique domain name. Apache calls
this method of creating a virtual server a non-IP intensive
virtual server.
The single IP address method conserves
IP addresses, which are a diminishing resource. This
method also requires less time and fewer configuration
changes, it is easily implemented using CNAME entries,
and it allows each customer to share the common server's
content settings. Under Apache, you can individualize
the settings for the user area (the VirtualHost directive
in the configuration file), but the daemon settings
for the single IP address are shared by each virtual
host.
However, because some browsers do not
support the single IP address method, you may have to
implement the multiple IP address virtual server method.
To directly access your customer's home
page, the user's client browser must support HTTP Version
1.1 protocol (the browser must pass the HTTP_HOST environment
variable). If the client browser does not support HTTP
Version 1.1, access to the ISP's home page. For browsers
that do not support HTTP Version 1.1, the ISP must provide
links to the customer home pages.
For information on configuring a virtual
server using the single IP address method, see:
Return to Table
of Contents
Multiple IP
Address
When you configure your web server as
a multiple IP address virtual server, you create an
instance of the web server and an IP address you bind
to that server instance for each customer domain name.
That is, you create a virtual server instance reconfigured
from an existing, installed, server for each customer
domain name you establish. You do not install a new
server. To configure a multiple IP address virtual server,
the operating system must also support your ability
to define a host name alias for each web server instance
and IP address combination (for example, ifconfig
alias on Tru64 UNIX).
Apache calls this method of creating
a virtual server an IP intensive virtual server.
Unlike the single IP address virtual
server method, each virtual server under the multiple
IP address method is a separate instance of the web
host. Customer sites are not constrained to HTTP Version
1.1 browser support. Under Apache, you can configure
an IP intensive virtual server with multiple daemons
or a single daemon and control the degree of difference
between each virtual server instance.
Under the multiple IP address virtual
server method, each server instance is unique and each
requires a separate IP address. For an ISP hosting a
number of customer domains on the web server, the large
number of directories, multiple IP addresses, and the
setup configurations for each instance can become a
maintenance challenge. On an Apache Web Host server,
you can mitigate this situation by configuring virtual
servers with the multiple IP address method using a
single daemon, rather than multiple daemons. Also note
that, on Tru64 UNIX, a single network card can support
at least 5000 IP addresses.
For information on configuring a virtual
server using the multiple IP address method, see:
Return to Table
of Contents
Apache
The method you use to establish the
Apache Web Server as a virtual server supporting multiple
domain names depends on the version of Apache Web Server
you have and the version of HTTP protocol you support.
Version 1.1 and later of the HTTP protocol
allows the server to determine the hostname that is
referenced by address; thus, you can associate more
than one domain name with the IP address that is linked
to the server. If you are using an Apache Web Server,
Version 1.1 or later and your environment supports HTTP
protocol, Version 1.1 or later, you can configure an
Apache non-IP address intensive virtual server.
Versions of the HTTP protocol prior
to Version 1.1 do not allow a server to determine the
hostname that is referenced by address; thus, each server
requires a unique IP address. If you are using a version
of the Apache Web Server that is earlier than Version
1.1 or your environment does not support a version of
HTTP protocol later than Version 1.1, you must configure
an Apache IP intensive virtual server.
If the versions of HTTP and Apache in
your environment require you to establish a separate
IP address and server instance for each virtual server,
use the non-IP intensive virtual server method to create
an Apache Virtual Web Host. The non-IP intensive virtual
server method allows you to conserve the diminishing
number of IP addresses while accommodating the growing
number of domains.
To define a virtual server, you use
VirtualHost directives. When the server gets a request
for a document on a particular virtual host, the server
uses the VirtualHost directives for that virtual
host to properly route and handle the request. Each
VirtualHost directive corresponds to a different
IP address or to a different host name for the Apache
Web Server. If you are configuring a virtual server
as an alternate host name, the Web Server must be able
to accept IP packets for multiple IP addresses. You
can use the Tru64 UNIX ifconfig alias command
to configure the Web Server for multiple addresses.
This section summarizes information
found on the Apache Web Server home page, http://www.apache.org/,
which contains information on configuration of the Apache
Server, reference to all directives, release notes,
and solutions to various implementation issues.
Return to Table
of Contents
Apache
Non-IP Intensive Virtual Server
To establish an Apache non-IP intensive
virtual server, you must establish a single instance
of the server and a single IP address associated with
that server. With those prerequisites met, you edit
the Apache configuration files to associate two or more
domain names with the server and to establish document
roots for the home pages of those domains.
Also, you must map an IP address alias
to the IP address associated with the server. To map
an IP address alias to the server's IP address, you
create canonical name, or CNAME, entries in your DNS
(Domain Name System) server for each domain name. For
example, if you have a web server defined as www.isp.com,
you can configure DNS with multiple CNAME entries that
point to www.isp.com. In this way, www.customer1.com,
www.customer2.com and other customer domain names can
share your ISP server, while each has a unique home
page and unique domain name.
- Ensure that there is an IP address
for the Apache Web Host.
- Ensure that there is a DNS entry
for each new virtual host and that the entry points
to the same IP address as the host server. Alternatively,
you can include the IP address in the VirtualHost
section of the configuration file.
- Edit the Apache httpd.conf configuration
file to add a VirtualHost section for each
domain you wish to link to the host server. The VirtualHost
section contains at least a ServerName and
DocumentRoot directive and an optional ServerAlias
directive.
- Reboot the Apache server.
Consider the following example of a
VirtualHost section from the httpd.conf configuration
file:
<VirtualHost www.apache.org>
ServerName www.apache.org
DocumentRoot /usr/web/apache
ServerAlias apache.org *.apache.org
</VirtualHost>
In this example, you define a virtual
host named www.apache.org, whose DNS entry must point
to the same IP address as the Apache Web Host server.
(You can also use the Apache Web Host server IP address
in the VirtualHost directive instead of the Apache Web
Host name. The document root for the www.apache.org
home page is placed at /usr/web/apache. Also, in this
example, you use the ServerAlias directive and a wildcard
to ensure that all apache.org addresses (www.apache.org,
ftp.apache.org, etc.) point to the Apache Web Host server.
For full documentation on Apache virtual
servers, including information on security concerns
when using virtual hosts and how to use virtual hosts
in an environment containing older browser versions,
refer to the documentation
repository at the Apache web site.
Return to Table
of Contents
Apache
IP Intensive Virtual Server
Versions of the HTTP protocol prior
to Version 1.1 do not allow a server to determine the
host name by which it is addressed, thus, each server
requires a unique IP address. If you are using a version
of the Apache Web Server that is earlier than Version
1.1 or your environment does not support a Version 1.1,
or later, HTTP protocol, you must configure an Apache
IP intensive virtual server (multiple IP address method).
Apache has two ways you can configure
an IP intensive virtual server:
- Run a separate httpd daemon for each
hostname.
Use this method when the different
virtual hosts need different HTTP configurations,
such as different values for ServerType,
User, Group, TypesConfig or ServerRoot.
Because an increase in the number of running daemons
has an impact on operating system performance, you
should not use this method if the Apache Web Host
server has a high request rate.
- Run a single daemon which supports
all the virtual hosts.
Use this method when the virtual
hosts can share an HTTPD configuration and when
the Apache Web Server host services a large number
of requests.
Separate daemons for each host name.
To configure an IP intensive virtual
server with separate daemons, first create a separate
HTTPD installation for each virtual server. For each
HTTPD installation, use the BindAddress directive
in the httpd.conf configuration file to select the IP
address (or virtual host) that the daemon will service.
For example:
BindAddress www.smallco.com
Alternatively, you can specify an IP
address instead of the host name, www.smallco.com.
Single daemon for all host names.
To configure an IP intensive virtual
server where a single HTTPD daemon services the requests
of all virtual hosts, use the VirtualHost directive
in the httpd.conf configuration file. In this directive,
set different values for ServerAdmin, ServerName,
DocumentRoot, ErrorLog and TransferLog
for each virtual host the Apache Web Host Server will
support. For example:
<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>
Alternatively, you can specify an IP
address instead of the host names, www.smallco.com and
www.baygroup.com.
For full documentation on Apache virtual
servers, including information on resource limits with
virtual hosts and methods you can use to reset those
limits, refer to the documentation
repository at the Apache web site.
Return to Table
of Contents
|