Server name-based virtual host defines multiple host names for one IP address in a server such as the DNS server and when clients access this host name, it appears as multiple hosts. You need not set multiple network interfaces. In the server name-based virtual host, you cannot build hosts for a combination of SSL and non-SSL, or for various SSLs. When you build hosts for these combinations, build by IP address-based virtual hosts.
- Example: Open a port on one Web server machine (IP address: 172.17.40.10), and switch hosts according to Web browser requests.
- If the request from Web browser is http://www1.xxx.soft.hitachi.co.jp/, see <Cosminexus-installation-directory>/httpsd/htdocs1/index.html (when DirectoryIndex is specified as index.html).
- If the request from Web browser is http://www3.xxx.soft.hitachi.co.jp/, see <Cosminexus-installation-directory>/httpsd/htdocs3/index.html (when DirectoryIndex is specified as index.html).
- However, you can use this method only when the host name (or the port number when required) is defined in the Host header during the request from the Web browser as Host: www1.xxx.soft.hitachi.co.jp. Note that this method cannot be used in old and simple Web browsers. In such cases, specifications of <VirtualHost> block coded at the topmost location are enabled (In this example www1.xxx.soft.hitachi.co.jp).
Port 80 ... 1.
NameVirtualHost 172.17.40.10 ... 2.
<VirtualHost 172.17.40.10> ... 3.
DocumentRoot "<Cosminexus-installation-directory>/httpsd/htdocs1" ... 4.
ServerName www1.xxx.soft.hitachi.co.jp ... 5.
</VirtualHost>
<VirtualHost 172.17.40.10> ... 6.
DocumentRoot "<Cosminexus-installation-directory>/httpsd/htdocs2" ... 7.
ServerName www2.xxx.soft.hitachi.co.jp ... 8.
</VirtualHost>
<VirtualHost 172.17.40.10> ... 9.
DocumentRoot "<Cosminexus-installation-directory>/httpsd/htdocs3" ... 10.
ServerName www3.xxx.soft.hitachi.co.jp ... 11.
</VirtualHost> |
- A port number
- IP address of the virtual host based on server name
- Definition of virtual host 1
- Definition of root directory
- Definition of server name 1
- Definition of virtual host 2
- Definition of root directory
- Definition of server name 2
- Definition of virtual host 3
- Definition of root directory
- Definition of server name 3
- #: You must register www1.xxx.soft.hitachi.co.jp, www2.xxx.soft.hitachi.co.jp, and www3.xxx.soft.hitachi.co.jp with the DNS server as host names of the host 172.17.40.10.
![[Figure]](figure/zu020700.gif)