JKL Toy Company adds dynamic content with server-side includes for HTTP Server (powered by Apache)

This scenario discusses how to add dynamic content with server-side includes.

Important: Information for this topic supports the latest PTF levels for HTTP Server for i5/OS . It is recommended 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 http://www.ibm.com/servers/eserver/iseries/software/http/services/service.htm Link outside Information Center for more information.

Scenario

The JKL Toy company (a fictitious company) wants to add some dynamic content to their index file (or welcome page) on their Web site. The welcome Web page is located in /www/jkltest/htdocs. The JKL Web administrator will add the current server time to display on their Web page.

Note: Server-side includes (SSI) create dynamic Web pages by adding content to a Web page before it is sent to the browser. Server performance may be impacted when processing SSIs.

Prerequisites

Edit the index file (or welcome page) with iSeries Navigator

For in-depth information on how to use the iSeries Navigator, read the iSeries Navigator help installed with the product.

  1. Start iSeries Navigator.
  2. Expand the iSeries the HTTP Server is installed on.

    Example: JKL_SERVER

  3. Expand File Systems > Integrated File System > Root > www > [server_name].

    Example: File Systems > Integrated File System > Root > www > jkltest

  4. Click htdocs.

    The directory htdocs is the default name of your document root provided by the Create New HTTP Server wizard.

  5. Right-click index.html.
  6. Click Rename.
  7. Rename the file index.shtml.
  8. Right-click index.shtml.
  9. Click Edit.
  10. Enter the following lines below the <BODY> tag and before the </BODY> tag:
    <p>The current server time is:
    <!--#config timefmt="%T" -->
    <!--#echo var="DATE_LOCAL" -->
    </p>
  11. Save and close the file.

See Server-side include commands for HTTP Server for more information about SSI commands.

Start the IBM® Web Administration for i5/OS™ interface

Note: Enter your Webmaster user profile username and password when prompted.
  1. Start a Web browser.
  2. Enter http://[iSeries_hostname]:2001 in the location or URL field .

    Example: http://jkl_server:2001

    Note: If you have changed your port number for the IBM Web Administration for i5/OS interface, replace port 2001 with your port number.
  3. Click IBM HTTP Server for iSeries.
Note: If the IBM Web Administration for i5/OS interface does not start, see Install and test the HTTP Server.

Set up server-side includes for HTTP Server (powered by Apache)

  1. Click the Manage tab.
  2. Click the HTTP Servers subtab.
  3. Select your HTTP Server (powered by Apache) from the Server list.

    Example: JKLTEST

  4. Select Global configuration from the Server area list.
  5. Expand Server properties.
  6. Click Container Management.
  7. Click the Files tab in the form.
  8. Click Add under the Files/Files Match containers table.
  9. Select Files Match from the list in the Type column.
  10. Enter \.shtml(\..+)?$ in the File name or expression column.
  11. Click Continue.
  12. Click OK.
  13. Select Files Match \.shtml(\..+)?$ from the Server area list.
  14. Expand Server Properties.
  15. Click Dynamic Content and CGI.
  16. Click the Server Side Includes tab in the form.
  17. Select Allow server side files without CGI under Server side includes.
  18. Click OK.
  19. Select Global configuration from the Server area list.
  20. Expand Server Properties.
  21. Click General Server Configuration.
  22. Click the Welcome Pages tab in the form.
  23. Select index.html in the Welcome/index file names table.
  24. Rename the file index.shtml in the File name column.
  25. Click Continue.
  26. Click OK.

Restart your HTTP Server (powered by Apache)

Select one of the following methods below:

Manage one server

  1. Click the Manage tab.
  2. Click the HTTP Servers subtab.
  3. Select your HTTP Server from the Server list.
  4. Click the Stop icon if the server is running.
  5. Click the Start icon.

Manage all servers

  1. Click the Manage tab.
  2. Click the HTTP Servers subtab.
  3. Select All Servers from the Server list.
  4. Click the All HTTP Servers tab.
  5. Select your HTTP Server name in the table.

    Example: JKLTEST

  6. Click Stop if the server is running.
  7. Click Start.
Note: If your HTTP Server (powered by Apache) does not start, see Troubleshoot.

Test your HTTP Server (powered by Apache)

  1. Start a new Web browser.
  2. Enter http://[iSeries_hostname]:[port] in the location or URL field.

    Example: http://jkl_server:1975

The Web page now displays the current server time.

View your HTTP Server (powered by Apache) configuration

Your configuration will look similar if you used the given example in this and previous examples.

  1. Click the Manage tab.
  2. Click the HTTP Servers subtab.
  3. Select your HTTP Server (powered by Apache) from the Server list.

    Example: JKLTEST

  4. Expand Tools.
  5. Click Display Configuration File.
Listen *:1975
DocumentRoot /www/jkltest/htdocs
ServerRoot /www/jkltest
Options -ExecCGI -FollowSymLinks -SymLinksIfOwnerMatch -Includes -IncludesNoExec -Indexes -MultiViews
AccessFileName .htaccess
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
DirectoryIndex index.shtml
<Directory />
	Order Deny,Allow
	Deny From all
</Directory>
<Directory /www/jkltest/htdocs>
	Order Allow,Deny
	Allow From all
</Directory>
<FilesMatch \.shtml(\..+)?$>
	Options +IncludesNoExec
	AddOutputFilter INCLUDES .shtml
</FilesMatch>