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 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.
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.
- Start iSeries Navigator.
- Expand the iSeries the HTTP Server is installed on.
Example: JKL_SERVER
- Expand File Systems > Integrated File System > Root > www > [server_name].
Example:
File Systems > Integrated File System > Root > www > jkltest
- Click htdocs.
The directory htdocs is the default name
of your document root provided by the Create New HTTP Server wizard.
- Right-click index.html.
- Click Rename.
- Rename the file index.shtml.
- Right-click index.shtml.
- Click Edit.
- 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>
- 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
- Start a Web
browser.
- Enter http://[iSeries_hostname]:2001 in the location or URL field
.
Example: http://jkl_server:2001
- Click IBM HTTP
Server for iSeries.
Set up server-side includes for HTTP Server (powered by Apache)
- 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 Container Management.
- Click the Files tab in the form.
- Click Add under the Files/Files Match containers table.
- Select Files Match from the list in the Type column.
- Enter \.shtml(\..+)?$ in the File name or expression column.
- Click Continue.
- Click OK.
- Select Files Match \.shtml(\..+)?$ from the Server area list.
- Expand Server Properties.
- Click Dynamic Content and CGI.
- Click the Server Side Includes tab in the form.
- Select Allow server side files without CGI under Server side
includes.
- Click OK.
- Select Global configuration from the Server area list.
- Expand Server Properties.
- Click General Server Configuration.
- Click the Welcome Pages tab in the form.
- Select index.html in the Welcome/index file names table.
- Rename the file index.shtml in the File name column.
- Click Continue.
- Click OK.
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.
Note: If your HTTP Server (powered by Apache) does not start, see
Troubleshoot.
Test your HTTP Server (powered by Apache)
- Start a new Web browser.
- 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.
- 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
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>