Configuring the IBM HTTP Server to work with WebSphere Commerce Developer

This tutorial describes how to install and configure IBM HTTP Server to work with the WebSphere® Commerce development environment, which is helpful for search engine optimization schemes, Web performance tuning, and proxy rerouting of requests.

Share:

Esther Yu (esthery@ca.ibm.com), Business Solution Architect, IBM

Photo: Esther YuEsther Yu is a Business Solution Architect with the WebSphere Commerce Solution Enablement team at the IBM Toronto Lab, Canada. She has over eight years of experience developing WebSphere Commerce solutions for ibm.com and other customers.



Craig Malton (cmalton@ca.ibm.com), Business Solution Architect, IBM

Photo: Craig MaltonCraig Malton is a Business Solution Architect with the WebSphere Commerce Solution Enablement team at the IBM Toronto Lab, Canada. He has over two years of experience developing and creating solutions for WebSphere Commerce. He has over a decade of experience designing Web-based infrastructure and applications using leading edge technologies.



Marco Deluca (madeluca@ca.ibm.com), Business Solution Architect, IBM

Photo: Marco DelucaMarco Deluca is a Business Solution Architect with the WebSphere Commerce Solution Enablement team at the IBM Toronto Lab, Canada. He brings over ten years of progressive experience to the enterprise software domain. Currently, Marco is responsible for designing and developing solutions for WebSphere Commerce. Additionally, he has over a decade of experience developing and designing rich media applications using leading edge technologies.



25 March 2008

Before you start

This tutorial describes how to configure the IBM HTTP Server with the WebSphere Commerce Development environment. Sample configuration files and step-by-step instructions are provided.

Objectives

The final objective is to have the IBM HTTP Server listen to and respond on the specified ports, communicating with the WebSphere Commerce Test Server. The Apache Web server will listen on ports 80 and 443, while all other ports continue to be monitored by the WebSphere Commerce Test Server. We provide you with a sample Web server configuration file that you can begin making changes to immediately. This file will also demonstrate some special Web server configurations. Figure 1 shows how your Web server will be configured after you complete this tutorial.

Figure 1. Configured Web server
Configured Web server

Prerequisites

This tutorial is written for Java™ programmers with skills and experience at a beginner level. You need general familiarity with the WebSphere Commerce development environment. Additionally, you also need to be familiar with configuring the IBM HTTP Server.

System requirements

To create the examples in this tutorial, you need WebSphere Commerce Developer V6 installed and configured.

Duration

This tutorial takes about one hour to complete.


Introduction

The WebSphere Commerce development environment is packaged with a WebSphere Commerce Test Server that acts as both a Web server and an application server. However, the Web server functionality has some limitations. Configuring an Apache Web server to interoperate between the client and the WebSphere Commerce Test Server is useful in some situations. Using an Apache Web server in your development environment is useful if you:

  • Have a search engine optimization strategy where you use mod_rewrites.
  • Want to enable file compression, file caching, configure expiration dates for static content to increase performance, or tune your application.
  • Are doing mash-up development.
  • Want to configure a reverse proxy to route your requests elsewhere.

This tutorial will walk you through the steps to install the IBM HTTP Server and configure it to work with the WebSphere Commerce development environment. If your intent is to configure the Web server for search engine optimization, we recommend that you read Search engine optimization: Improving findability with a configurable URL tag library.


Instructions

Several steps are needed to configure both the IBM HTTP Server and the WebSphere Commerce Development environment. At a high-level, the steps are:

  1. Download the IBM HTTP Server.
  2. Install the IBM HTTP Server.
  3. Download the WebSphere Application Server plugin.
  4. Install the WebSphere Application Server plugin.
  5. Configure the IBM HTTP Server.
  6. Copy the plugin-config.xml file.
  7. Configure the WebSphere Commerce Test Server.

Step 1. Download the IBM HTTP Server

If you have already purchased WebSphere software, you may already have an installable version of the IBM HTTP Server. If not, you can download the IBM HTTP Server 6.1. You need about 1.5GB of storage to save and extract the archive. Download this archive and place it on your WebSphere Commerce Developer system. You are now ready to install the IBM HTTP Server.


Step 2. Install the IBM HTTP Server

  1. Unzip the package you downloaded to a temporary directory called c:\WebSphere_download. Double-click the file C:\WebSphere_download\IHS_6.1.0.0\IHS\install.exe to begin the install process. Follow the installation wizard through the first few screens. On the install directory screen, select C:\WebSphere\IHS as shown in Figure 2.
    Figure 2. IBM HTTP Server install directory
    IBM HTTP Server install directory
  2. Leave the port values for the HTTP and HTTP Administration servers as 80 and 8008. Click Next.
  3. On the "Windows Service Definition" screen, make sure both the HTTP and HTTP Administration servers are set to run as a Windows® service.
  4. Select Log on as a specified user account and use a user that has Windows administrative authority (Figure 3). Click Next.
    Figure 3. Windows Service Definition
    Windows Service Definition
  5. On the "HTTP Administration Server Authentication" screen make sure Create a user ID for IBM HTTP Server administration server authentication is unchecked. Click Next.
  6. You are presented with a summary screen as shown in Figure 4. Review your choices and click Next to install the IBM HTTP Server.
    Figure 4. IHS Summary
    IHS Summary
  7. The wizard will install the IBM HTTP Server. When complete, click Finish to exit the installation wizard.

This completes the IBM HTTP Server installation and leads you to the next section on Web server plugin installation.


Step 3. Download the WebSphere Application Server V6.1 plugin

The WebSphere plugin is a piece of code that bridges the IBM HTTP Server with the WebSphere Commerce server. It defines how the two servers communicate. You can download the WebSphere Application Server V6.1 plugin. You are now ready to install the WebServer plugin for WebSphere Application Server for Windows.


Step 4. Install the WebSphere Application Server plugin

  1. Unzip the package you downloaded to a temporary directory called c:\WebSphere_download\Plugin. Double-click the file C:\WebSphere_download\Plugin\plugin\install.exe to begin the install process. On the welcome screen, ensure all the checkboxs are not selected as shown in Figure 5. Click Next.
    Figure 5. WebSphere Application Server Plugin Welcome screen
    WebSphere Application Server Plugin Welcome screen
  2. Select IBM HTTP Server V6 or V6.1 and click Next.
  3. Select Web server machine (remote) and click Next.
  4. Choose C:\WebSphere\Plugins as the installation directory and click Next as shown in Figure 6.
    Figure 6. Plugin installation directory
    Plugin installation directory
  5. Specify the HTTP Server httpd.conf file location that was installed in the previous wizard. The path in our example is C:\WebSphere\IHS\conf\httpd.conf. Ensure port 80 is the selected port as shown in Figure 7. Click Next.
    Figure 7. httpd.conf file location
    httpd.conf file location
  6. Make sure the Web server definition name is webserver1. Click Next.
  7. Leave the default plugin configuration file location as it is and click Next.
  8. Specify the application server name. For example, "localhost" is a local computer's name. Click Next.
  9. Continue clicking Next until you get to the installation summary screen. Ensure all the settings are correct and click Next to install the WebSphere Application Server plugin as shown in Figure 8.
    Figure 8. Installation Summary
    Installation Summary
  10. Click Finish to complete the wizard.

You have now installed the WebSphere Application Server plugin. Next, you will configure the IBM HTTP Server.


Step 5. Configure the IBM HTTP Server

By default, the IBM HTTP Server configuration file is not configured to support SSL. You will need to configure the server to support SSL. You can use a SSL self-signed certificate or an externally signed certificate from a third party. A self-signed certificate is included in the download file for this tutorial in the IHS\SSLKeys directory. The password for this key is "is8enuff". A sample httpd.conf file is located in IHS\conf.

  1. Copy the IHS\SSLKeys directory to C:\WebSphere\IHS.
  2. Backup the C:\WebSphere\IHS\conf\httpd.conf file.
  3. Open the C:\WebSphere\IHS\conf\httpd.conf file.
  4. Copy the following lines into the bottom of the file:
    Listing 1. httpd.conf configuration
    # Enable this module and configuration for SSL support
    LoadModule ibm_ssl_module modules/mod_ibm_ssl.so
    
    SSLDisable
    KeyFile "C:\WebSphere\IHS\SSLKeys\sslkeys.kdb"
    
    # Example:  Enable this module and configuration for tagging 
    #	static content with expires dates
    LoadModule expires_module modules/mod_expires.so
    
    ExpiresActive on
    ExpiresByType image/gif "access plus 3 days"
    ExpiresByType image/png "access plus 3 days"
    ExpiresByType image/jpeg "access plus 3 days"
    ExpiresByType application/x-shockwave-flash "access plus 3 days"
    ExpiresByType image/x-icon "access plus 3 days"
    ExpiresByType text/javascript "access plus 3 days"
    ExpiresByType application/x-javascript "access plus 3 days"
    ExpiresByType text/css "access plus 3 days"
    ExpiresDefault "access plus 3 days"
    
    # Example: Enable these modules and configuration to setup a proxy route
    LoadModule proxy_module modules/mod_proxy.so
    LoadModule proxy_http_module modules/mod_proxy_http.so
    
    ProxyRequests Off
    ProxyPass /bvstaging/ http://555.555.555.555/bvstaging/
    ProxyPassReverse /bvstaging/ http://555.555.555.555/bvstaging/
    
    # Example: Enable this module to use the Apache mod_rewrite feature
    LoadModule rewrite_module modules/mod_rewrite.so
    
    # listen to ports 80 and 443 on the localhost machine  
    Listen 0.0.0.0:80
    Listen 0.0.0.0:443
    
    <VirtualHost *:80>
    ServerName *
    Alias	/wcsstore "C:\IBM\WCToolkitEE60\workspace\Stores\WebContent"
    Alias	/wcs "C:\IBM\WCToolkitEE60\workspace\CommerceAccelerator\WebContent"
    
    # Example:  Turn on the rewrite engine.
    RewriteEngine On
    
    </VirtualHost>
    <VirtualHost *:443>
    SSLEnable
    SSLClientAuth 0
    ServerName *
    Alias	/wcsstore "C:\IBM\WCToolkitEE60\workspace\Stores\WebContent"
    Alias	/wcs "C:\IBM\WCToolkitEE60\workspace\CommerceAccelerator\WebContent"
    </VirtualHost>

    You will need to alter the Alias lines to match your environment. To learn how you can apply mod_rewrite rules to work in conjunction with WebSphere Commerce, see Improving findability with a configurable URL tag library.
  5. Disable AFPA by commenting out the following lines:
    Listing 2. Disabling AFPA
    ##
    ## To enable AFPA on supported Windows Operating Systems delete the "#" symbol in 
    ## front of the "LoadModule ibm_afpa_module modules/mod_afpa_cache.so" directive
    ##
    #LoadModule ibm_afpa_module modules/mod_afpa_cache.so
    #<IfModule mod_afpa_cache.c>
    #  AfpaEnable
    #  AfpaCache on
    #  AfpaPort  80
    #  AfpaLogFile "C:/IHS/logs/afpalog" V-ECLF
    #</IfModule>
    
    ##
    ## Configuration with AFPA disabled
    ##
    #<IfModule !mod_afpa_cache.c>
    #  Listen 80
    
    # Use Win32DisableAcceptEx to downgrade to use winsock 1.1 network APIs.
    # Note: You can use Win32DisableAcceptEx only if mod_afpa_cache.so is disabled.
    # Win32DisableAcceptEx
    #</IfModule>
  6. Modify the DocumentRoot entry to match the location that you used for the /wcsstore aliases above. For example:
    DocumentRoot "C:/IBM/WCToolkitEE60/workspace/Stores/WebContent"
  7. Find <Directory "C:/IHS/htdocs/en_US"> and change the directory path to the location you used for the /wcsstore aliases above. For example:
    <Directory "C:\IBM/WCToolkitEE60\workspace\Stores\WebContent">
  8. Save the httpd.conf file.

You are now finished configuring the IBM HTTP Server. Next, you will need to copy the plugin-config.xml file so that the WebSphere plugin knows which requests to send to the WebSphere Commerce Test Server.


Step 6. Copy plugin-cfg.xml file to the WebSphere plugin directory

The WebSphere Application Server plugin uses a configuration file, plugin-config.xml, that defines which requests need to be forwarded from the IBM HTTP Server to the WebSphere Commerce Test Server. A configuration file has been provided for you to use in the download file for this tutorial in the Plugins directory. Copy the Plugins\config directory to C:\WebSphere\Plugins.

You may need to make changes to the plugin-cfg.xml file to match your environment, especially if you've changed the WebSphere Commerce context root from /webapp/wcs to another value.

Next, you will need to configure the WebSphere Commerce Test Server to support communication with the IBM HTTP Server.


Step 7. Configure the WebSphere Commerce Test Server

By default, the WebSphere Commerce Test Server listens for requests on ports 80 and 443. Since you have just configured the IBM HTTP Server to listen on these ports, you must change the WebSphere Commerce Test Server to listen on different ports to remove the conflict. This tutorial uses ports 10080 and 10443 for ports 80 and 443, respectively.

A WebSphere Application Server wsadmin jython script is provided in the download file for this tutorial as WAS\configureWCPorts.py. Depending on your configuration, you may need to change the nodename and hostname parts of this file before running it. We are assuming the default configuration in this script.

Listing 3. wsadmin script to change the Test Server ports
AdminTask.modifyServerPort ('server1', '[-nodeName localhost -endPointName 
WC_defaulthost -host localhost -port 10080]')
AdminTask.modifyServerPort ('server1', '[-nodeName localhost -endPointName 
WC_defaulthost_secure -host localhost -port 10443]')
AdminConfig.save()
  1. Ensure WebSphere Commerce Test Server is stopped.
  2. Copy the WAS\configureWCPorts.py script to the <WCTOOLKIT>\wasprofile\bin directory.
  3. Open a Windows command prompt and change the directory to <WCTOOLKIT>\wasprofile\bin.
  4. Type wsadmin -lang jython -f configureWCPorts.py -conntype NONE.
  5. Start the WebSphere Commerce Test Server.
  6. Start or restart the IBM HTTP Server.

You can test your configuration by accessing your WebSphere Commerce stores using a Web browser. Notice in the IBM HTTP Server access.log that requests are now being logged. This indicates that the IBM HTTP Server is handling requests for ports 80 and 443. You are now finished configuring the WebSphere Commerce Test Server to help communicate with the IBM HTTP Server.


Conclusion

In this tutorial, you have configured and installed the IBM HTTP Web server on your WebSphere Commerce development machine to handle Web based requests for ports 80 and 8000. You can start and stop the Web server from your Windows Services control panel. The service is called "IBM HTTP Server 6.1" and, by default, is started automatically when your machine reboots. When you have successfully configured the two applications to function together, you will notice a slight performance improvement. You now have complete Web server functionality. You can take advantage of the Web server caching and rewriting functionality to test further configurations as required by your application.


Download

DescriptionNameSize
Code sampleIHS_Sample.zip28 KB

Resources

Comments

developerWorks: Sign in

Required fields are indicated with an asterisk (*).


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Information in your profile (your name, country/region, and company name) is displayed to the public and will accompany any content you post, unless you opt to hide your company name. You may update your IBM account at any time.

All information submitted is secure.

Choose your display name



The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


All information submitted is secure.

Dig deeper into WebSphere on developerWorks


static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=WebSphere
ArticleID=376708
ArticleTitle=Configuring the IBM HTTP Server to work with WebSphere Commerce Developer
publish-date=03252008