4.3.2 Virtual host based on IP address
The IP address-based virtual host appears as multiple hosts to clients by the following three methods:
-
Using multiple ports
-
Specifying multiple network interfaces in a single server machine
-
Specifying an alias of an IP address
- Example 1: Open two ports on a Web server on a single server machine, and run as two hosts, one as a Web server that supports SSL and the other as a Web server that does not support SSL.
Listen 443 ...1 Listen 80 ...2 <VirtualHost xxx.soft.hitachi.co.jp:443> ...3 DocumentRoot "Application-Server-installation-directory/httpsd/ssldocs" SSLEngine On ...4 SSLCertificateFile "Application-Server-installation-directory/httpsd/conf/ssl/server/httpsd.pem" SSLCertificateKeyFile "Application-Server-installation-directory/httpsd/conf/ssl/server/httpsdkey.pem" </VirtualHost> <VirtualHost xxx.soft.hitachi.co.jp:80> ...5 DocumentRoot "Application-Server-installation-directory/httpsd/htdocs" SSLEngine Off ...6 </VirtualHost>
-
Definition of port number
-
Definition of port number
-
Definition of virtual host of port number 443
-
Enable SSL
-
Definition of Virtual host of port number 80
-
Disable SSL
-
- Example 2: Provide two NIC (Network Interface Card) (IP address: 172.17.40.10 and 172.17.40.20) on a single server machine, and switch hosts according to Web browser requests, on a single Web server.
-
If the request from Web browser is http://172.17.40.10/, see Application-Server-installation-directory/httpsd/htdocs1/index.html (when DirectoryIndex is specified as index.html).
If the request from Web browser is http://172.17.40.20/, see Application-Server-installation-directory/httpsd/htdocs2/index.html (when DirectoryIndex is specified as index.html).
Listen 80 <VirtualHost 172.17.40.10> DocumentRoot "Application-Server-installation-directory/httpsd/htdocs1" ServerName www10.xxx.soft.hitachi.co.jp </VirtualHost> <VirtualHost 172.17.40.20> DocumentRoot "Application-Server-installation-directory/httpsd/htdocs2" ServerName www20.xxx.soft.hitachi.co.jp </VirtualHost>