Setting up the Webserver search engine on HTTP Server (powered by Apache)

 

This topic provides information about how to set up the Webserver search engine for your HTTP Server with the Web Administration for i5/OS interface.

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.

The Webserver search engine allows you to perform full text searches on HTML and text files. You an control what options are available to the user and how the search results are displayed through customized Net.Data® macros.

Follow these steps to configure the Webserver search engine for HTTP Server (powered by Apache) using the Web Administration for i5/OS interface.

 

Editing 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.

  4. Select Global configuration from the Server area list.

  5. Expand HTTP Tasks and Wizards.

  6. Click Add a directory to the Web.

    Using the wizard, create a new directory to serve static Web content, with directory /www/MyServer/scripts/, and with an alias /scripts/, where MyServer is the name of your HTTP Server (powered by Apache). See JKL Toy Company adds a new directory to HTTP Server (powered by Apache) for more information.

    The new scripts directory and the directory containing the files to be searched must have *Public *RX authority or Net.data will return an error.

  7. Expand Server Properties.

  8. Click Container Management.

  9. Click the Directories tab in the form.

  10. Click Add under the Directory/Directory Match container table.

  11. Select Directory from the list in the Type column.

  12. Enter /QSYS.LIB/QHTTPSVR.LIB/ in the Directory path or expression column.

  13. Click Continue.

  14. Click OK.

  15. Click URL Mapping.

  16. Click the Aliases tab in the form.

  17. Click Add under the URL to host file system mappings table.

  18. Select Alias from the list in the Alias Type column.

  19. Enter /htdocs/ in the URL path column.

  20. Enter /www/MyServer/htdocs in the Host directory or file column, where MyServer is the name of your HTTP Server (powered by Apache).

  21. Click Add.

  22. Select ScriptAlias from the list in the Alias Type column.

  23. Enter /cgi-bin/db2www/ in the URL path column.

  24. Enter /QSYS.LIB/QHTTPSVR.LIB/DB2WWW.PGM/ in the Host directory or file column.

  25. Click Continue.

  26. Click OK.

  27. Select Directory \www\MyServer\scripts\ from the Server area list, where MyServer is the name of your HTTP Server (powered by Apache).

  28. Click Dynamic Content and CGI.

  29. Click the General Settings tab in the form.

  30. Select Enabled for Allow CGI programs to be run.

  31. Click OK.

  32. Click Security.

  33. Click the Control Access tab in the form.

  34. Select All authenticated users (valid user name and password) under Control access based on who is making the request.

  35. Select Allow then deny from Order for evaluating access under Control access based on where the request is coming from.

  36. Select All client hosts under Client hosts allowed access to this resource.

  37. Click OK.

  38. Select Directory /QSYS.LIB/QHTTPSVR.LIB/ from the Server area list.

  39. Click Dynamic Content and CGI.

  40. Click the General Settings tab in the form.

  41. Select Enabled for Allow CGI programs to be run.

  42. Click OK.

  43. Click Security.

  44. Click the Control Access tab in the form.

  45. Select All authenticated users (valid user name and password) under Control access based on who is making the request.

  46. Select Allow then deny from Order for evaluating access under Control access bade on where the request is coming from.

  47. Select All client hosts under Client hosts allowed access to this resource.

  48. Click OK.

 

Creating a search index

  1. Click the Advanced tab.

  2. Click the Search Setup subtab.

  3. Expand Search Engine Setup.

  4. Click Create search index.

  5. Enter an index name in the Index name field.

  6. Click Apply.

  7. Select Build a document list from this directory under Document list.

  8. Enter the directory where the HTML and text files to searched are located. Example, /www/MyServer/htdocs, where MyServer is the configuration directory of your HTTP Server (powered by Apache).

  9. Select Create a mapping rules file from this HTTP server under Mapping rules.

  10. Select your HTTP Server (powered by Apache) configuration name from the list.

  11. Enter a URL prefix in the Prefix to use for URL address field. Example, http://iSeries™:Port, where iSeries:Port is the name of your iSeries and port number.

    Remember the search index name and mapping rules directory and file name. This information will be used in the following steps.

  12. Click Apply.

 

Copying sample_search.ndm and sample_html.html files

  1. Open directory \QIBM\ProdData\HTTP\Public\HTTPSVR.

  2. Copy sample_html.html to \www\MyServer\htdocs directory, where MyServer is the configuration directory of your HTTP Server (powered by Apache).

  3. Copy sample_search.ndm to \www\MyServer\scripts directory, where MyServer is the configuration directory of your HTTP Server (powered by Apache).

File sample_search.ndm must have *Public *RX authority or Net.data will return an error.

 

Editing sample_search.ndm

  1. Open sample_search.ndm with a text editor.

  2. Change the following lines found under %{ ---- STEP 1 -----%}:

    idxIndexName="Recipes"

    Search index name: replace Recipes with the name of your search index.

    mapFile=""

    Map file directory and name: add /QIBM/UserData/HTTPSVR/index/SearchIndex.MAP_FILE, where SearchIndex is the name of your search index.

  3. Save and close the file.

The sample_search.ndm file has additional fields that allow you to modify the search results displayed with the Webserver search engine. Read the documentation provided in the sample_search.ndm file for more details.

 

Editing sample_html.html

  1. Open sample_html.html with a text editor.

  2. Change the following lines:

    FORM NAME="search" ACTION="/cgi-bin/db2www/qibm/proddata/http/public/httpsvr/sample_search.ndm/output" METHOD="post">

    Replace the ACTION attribute value with /cgi-bin/db2www/www/MyServer/scripts/sample_search.ndm/output, where MyServer is the configuration directory of your HTTP Server (powered by Apache)

    <INPUT TYPE="hidden" NAME="frmIndexName" VALUE="Recipes">

    Search index name: replace Recipes with the name of your search index.

    <INPUT TYPE="hidden" NAME="frmMapFile" VALUE=" ">

    Map file directory and name: add /QIBM/UserData/HTTPSVR/index/SearchIndex.MAP_FILE to the VALUE attribute, where SearchIndex is the name of your search index.

  3. Save and close the file.

The sample_html.html file contains additional fields for the Webserver search engine. Only the necessary information for the required fields are documented here.

 

Starting the server

  1. Click the Manage tab.

  2. Click the All Servers subtab.

  3. Click the All HTTP Servers tab.

  4. Select your HTTP Server (powered by Apache) from the table.

  5. Click Start.

 

Testing the Webserver search engine

  1. Open a Web browser.

  2. Enter http://iSeries:Port/sample_html.html to start the Webserver search engine, where iSeries:Port is the name of your iSeries and port number.

  3. Enter a search term.

  4. Click Search.

If the MAP_FILE is incorrectly built, the search results will not contain the correct URL and the Web page will not be displayed.

 

Parent topic:

Search tasks