Apache + Perl + PHP3 + MySQL Windows 9x


MySQL - 8


<VirtualHost _default_:*>

DocumentRoot /www/default

...

</VirtualHost>

The default vhost for port 80 (which must appear before any default vhost with a wildcard port) catches all requests that were sent to an unspecified IP address. The main server is never used to serve a request.

         Setup 3: We want to have a default vhost for port 80, but no other default vhosts.

Server configuration:

...

<VirtualHost _default_:80>

DocumentRoot /www/default

...

</VirtualHost>

A request to an unspecified address on port 80 is served from the default vhost any other request to an unspecified address and port is served from the main server.

Migrating a name-based vhost to an IP-based vhost

         Setup: The name-based vhost with the hostname www.otherdomain.tld

(from our name-based example, setup 2) should get its own IP address. To avoid problems with name servers or proxies who cached the old IP address for the name-based vhost we want to provide both variants during a migration phase.

The solution is easy, because we can simply add the new IP address (111.22.33.66) to the VirtualHost

directive.

Server configuration:

...

Port 80

ServerName www.domain.tld

DocumentRoot /www/domain

 

NameVirtualHost 111.22.33.55

 

<VirtualHost 111.22.33.55 111.22.33.66>

DocumentRoot /www/otherdomain

ServerName www.otherdomain.tld

...

</VirtualHost>

<VirtualHost 111.22.33.55>

DocumentRoot /www/subdomain

ServerName www.sub.domain.tld

ServerAlias *.sub.domain.tld

...

</VirtualHost>

The vhost can now be accessed through the new address (as an IP-based vhost) and through the old address (as a name-based vhost).

Using the ServerPath

directive

         Setup: We have a server with two name-based vhosts. In order to match the correct virtual host a client must send the correct Host:




- -  - -  - -