JKL Toy Company creates virtual hosts on HTTP Server (powered by Apache)
In the IBM HTTP Server for i5/OS, you can create virtual hosts.
Information for this topic supports the latest PTF levels for HTTP Server for i5/OS . IBM recommends that you install the latest PTFs to upgrade to the latest level of the HTTP Server for i5/OS. Some of the topics documented here are not available prior to this update. See IBM Service for more information.
Scenario
The JKL Toy Company (a fictitious company) wants to serve two domain names from one IP address. This can be done using virtual hosts.
The JKL Web administrator has decided to use the name-based virtual host for HTTP Server (powered by Apache) JKLTEST. The ISP has configured the Domain Name Server to route requests for JKLINFO to IP address 9.5.61.228, port 78.
Prerequisites
- It is assumed you have read Scenarios for HTTP Server.
- It is assumed you have read and completed JKL Toy Company creates an HTTP Server (powered by Apache) or you have an existing HTTP Server (powered by Apache) configuration.
- It is assumed you are familiar with Domain Name Servers (DNS).
Start the IBM Web Administration for i5/OS interface
Enter your Webmaster user profile username and password when prompted.
- Start a Web browser.
- Enter http://[iSeries_hostname]:2001 in the location or URL field .
Example: http://jkl_server:2001
If you have changed your port number for the Web Administration for i5/OS interface, replace port 2001 with your port number.
- Click IBM® HTTP Server for iSeries.
If the Web Administration for i5/OS interface does not start, see Installing and testing the HTTP Server.
Set up a name-based virtual host
- Click the Manage tab.
- Click the HTTP Servers subtab.
- Select your HTTP Server (powered by Apache) from the Server list.
Example: JKLTEST
- Select Global configuration from the Server area list.
- Expand Server Properties.
- Click Virtual Hosts.
- Click the Name-based tab in the form.
- Click Add under the Named virtual hosts table.
- Select or enter an IP address in the IP address column.Example: 9.5.61.228
The IP address 9.5.61.288 used in this scenario is associated with JKL Toy Company's iSeries™ hostname JKLINFO and registered by a Domain Name Server (DNS). You will need to choose a different IP address and hostname. The Web Administration for i5/OS interface provides the IP addresses used by your iSeries system in the IP Address list; however, you will need to provide the hostname associated with the address you choose.
- Enter a port number in the Port column.
Example: 78
- Click Add under the Virtual host containers table in the Named host column.
- Enter the fully qualified server hostname for the virtual host in the Server name column.
Example: JKLINFO.com
Make sure the server hostname you enter is fully qualified and associated with the IP address you selected.
- Enter a document root for the virtual host index file or welcome file in the Document root column.
Example: /www/jkltest/companyinfo/
You are specifying a document root using a directory that will be added below in the Set up the virtual host directories section.
- Click Continue.
- Click OK.
Set up Listen directive for virtual host
- Expand Server Properties.
- Click General Server Configuration.
- Click the General Settings tab in the form.
- Click Add under the Server IP addresses and ports to listen on table.
- Select the IP address you entered for the virtual host in the IP address column.
Example: 9.5.61.288
- Enter the port number you entered for the virtual host in the Port column.
Example: 78
- Accept Disabled default for FRCA.
- Click Continue.
- Accept the default values for the remainder of the form.
- Click OK.
Set up the virtual host directories
- Select the virtual host from the Server area list.
- Expand HTTP Tasks and Wizards.
- Click Add a Directory to the Web.
- Click Next.
- Select Static web pages and files.
- Click Next.
- Enter a directory name for the virtual host in the Name field.
Example: /www/jkltest/companyinfo/
- Click Next.
- Enter an alias for the virtual host in the Alias field.
Example: /companyinfo/
- Click Next.
- Click Finish.
The document root and directory for the virtual host has been created.
Restart your HTTP Server (powered by Apache)
Select one of the following methods below:
Manage one server
- Click the Manage tab.
- Click the HTTP Servers subtab.
- Select your HTTP Server from the Server list.
- Click the Stop icon if the server is running.
- Click the Start icon.
Manage all servers
- Click the Manage tab.
- Click the HTTP Servers subtab.
- Select All Servers from the Server list.
- Click the All HTTP Servers tab.
- Select your HTTP Server name in the table.
Example: JKLTEST
- Click Stop if the server is running.
- Click Start.
If your HTTP Server (powered by Apache) does not start, see Troubleshooting.
Test your HTTP Server (powered by Apache)
- Start a new Web browser.
- Enter http://[virtual_hostname_name]:[port] in the location or URL field.
Example: http://JKLINFO:78
View your HTTP Server (powered by Apache) configuration
Your configuration will look similar if you used the given example in this and previous examples.
- Click the Manage tab.
- Click the HTTP Servers subtab.
- Select your HTTP Server (powered by Apache) from the Server list.
Example: JKLTEST
- Expand Tools.
- Click Display Configuration File.
Listen *:1975 Listen 9.5.61.228:78 DocumentRoot /www/jkltest/htdocs ServerRoot /www/jkltest Options -ExecCGI -FollowSymLinks -SymLinksIfOwnerMatch -Includes -IncludesNoExec -Indexes -MultiViews NameVirtualHost 9.5.61.228:78 LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined LogFormat "%{Cookie}n \"%r\" %t" cookie LogFormat "%{User-agent}i" agent LogFormat "%{Referer}i -> %U" referer LogFormat "%h %l %u %t \"%r\" %>s %b" common CustomLog logs/access_log combined SetEnvIf "User-Agent" "Mozilla/2" nokeepalive SetEnvIf "User-Agent" "JDK/1\.0" force-response-1.0 SetEnvIf "User-Agent" "Java/1\.0" force-response-1.0 SetEnvIf "User-Agent" "RealPlayer 4\.0" force-response-1.0 SetEnvIf "User-Agent" "MSIE 4\.0b2;" nokeepalive SetEnvIf "User-Agent" "MSIE 4\.0b2;" force-response-1.0 <Directory /> Order Deny,Allow Deny From all </Directory> <Directory /www/jkltest/htdocs> Order Allow,Deny Allow From all </Directory> <VirtualHost 9.5.61.228:78> ServerName JKLINFO.com DocumentRoot /www/jkltest/companyinfo/ <Directory /www/jkltest/companyinfo> Order Allow,Deny Allow From all </Directory> Alias /companyinfo/ /www/jkltest/companyinfo/ </VirtualHost>
Parent topic:
Scenarios for HTTP Server