From S23Wiki
Jump to: navigation, search

If you want to host several domain names on one physical machine there are different approaches:

First decide whether to use IP-based or Name-based virtual hosts.

If you have multiple IPs then you can choose whether to run a single apache to host them all or to run multiple deamons.:

Apache IP-based Virtual Host Support

As the term IP-based indicates, the server must have a different IP address for each IP-based virtual host.

Use multiple daemons when:

- There are security partitioning issues, such as company1 does not want anyone at company2 to be able to read their data except via the web. In this case you would need two daemons, each running with different User, Group, Listen,and ServerRoot settings.

- You can afford the memory and file descriptor requirements of listening to every IP alias on the machine. It's only possible to Listen to the "wildcard" address, or to specific addresses. So if you have a need to listento a specific address for whatever reason, then you will need to listen to all specific addresses. (Although one httpd could listen to N-1 of the addresses, and another could listen to the remaining address.)

Use a single daemon when:

- Sharing of the httpd configuration between virtual hosts is acceptable.

- The machine services a large number of requests, and so the performance loss in running separate daemons may be significant.


If you choose to use Name-based virtual hosts you need to configure a DNS server:

Name-based virtual hosting is usually simpler, since you need only configure your DNS server to map each hostname to the correct IP address and then configure the Apache HTTP Server to recognize the different hostnames. Name-based virtual hosting also eases the demand for scarce IP addresses. Therefore you should use name-based virtual hosting unless there is a specific reason to choose IP-based virtual hosting.

Some reasons why you might consider using IP-based virtual hosting:

- Some ancient clients are not compatible with name-based virtual hosting. For name-based virtual hosting to work, the client must send the HTTP Host header. This is required by HTTP/1.1, and is implemented by all modern HTTP/1.0 browsers as an extension. If you need to support obsolete clients and still use name-based virtual hosting, a possible technique is discussed at the end of this document.

- Name-based virtual hosting cannot be used with SSL secure servers because of the nature of the SSL protocol.

- Some operating systems and network equipment implement bandwidth management techniques that cannot differentiate between hosts unless they are on separate IP addresses.

External Links