Skip to end of metadata
Go to start of metadata

For production environment, it's good to have a front end server like Apache.

While we present mod_jk and mod_proxy below, since 2012 we've been preferring using mod_proxy as it is simpler to configure and its performance improvements in the past few years have shown to be as fast (if not faster than the native java jk protocol).

So if you are to choose between the two, go with mod_proxy.

Using Apache 2.4 and mod_proxy

Add/enable the following to your httpd.conf:

...
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
...

Then on your virtual host config:

<VirtualHost>
...
  ProxyRequests Off
  ProxyPreserveHost On
  
  <Proxy *>
     Require all granted
  </Proxy>
  
  ProxyPass /lams http://localhost:8080/lams
  ProxyPassReverse /lams http://localhost:8080/lams
  
  <Location /lams>
	Require all granted
  </Location>	
  
...
</VirtualHost>

Using Apache/IIS with LAMS (mod_jk)

If you want LAMS to coexist with another web server listening on port 80 on the same machine, and that web server is supported by the mod_jk connector, then you can use mod_jk to pass all requests from your web server through to lams.

See http://tomcat.apache.org/connectors-doc/ for the latest mod_jk binaries and documentation. http://wiki.jboss.org/wiki/Wiki.jsp?page=UsingMod_jk1.2WithJBoss outlines how to use mod_jk with jboss.

LAMS

On the LAMS side, all you need to do is install LAMS normally, by default it will be listening on port 8009, which will be used by the mod_jk connector. If you've changed this behaviour, then it's probably safe to assume you know what you're doing already.

Apache

  1. Download the mod_jk .so (unix) or .dll (windows) file from http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/, and place it in your Apache's modules directory.
  2. Add the module to your apache config. Update the paths as per your system.
      # Load mod_jk module
      # Update this path to match your modules location
      LoadModule    jk_module  modules/mod_jk.so
      # Where to find workers.properties
      # Update this path to match your conf directory location (put workers.properties next to httpd.conf)
      JkWorkersFile /etc/httpd/conf/workers.properties
      # Where to put jk shared memory
      # Update this path to match your local state directory or logs directory
      JkShmFile     /var/log/httpd/mod_jk.shm
      # Where to put jk logs
      # Update this path to match your logs directory location (put mod_jk.log next to access_log)
      JkLogFile     /var/log/httpd/mod_jk.log
      # Set the jk log level [debug/error/info]
      JkLogLevel    info
      # Select the timestamp log format
      JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
      # Send everything for context /examples to worker named worker1 (ajp13)
      JkMount  /lams/* worker1
    
  3. Create a workers.properties file in the location pointed to by JkWorkersFile directive above
      # Define 1 real worker using ajp13
      worker.list=worker1
      # Set properties for worker1 (ajp13)
      worker.worker1.type=ajp13
      worker.worker1.host=localhost
      worker.worker1.port=8009
    
  4. Restart apache.

IIS

  1. See http://tomcat.apache.org/connectors-doc/webserver_howto/iis.html. The part with the steps you want to follow is under the heading 'Configuring the ISAPI redirector'.
  2. Use the workers.properties file above.
  3. Use the following uriworkermap.properties file.
      /lams=worker1
      /lams/*=worker1
    
  4. If using IIS6, also do the following (taken from http://www.cflex.net/showFileDetails.cfm?ObjectID=296):
    • Open the ... Administrative Tools, Internet Information Services console.
    • In the tree on the left, click " Web Service Extensions"
    • In the right hand pane, click "Add a new Web Service Extension"
    • For the Extension Name, enter: Jakarta Tomcat
    • Click the "Add" button.
    • Browse and select C:\Program Files\Apache Software Foundation\Jakarta Isapi Redirector\bin\isapi_redirector.dll
    • Click the "Allow" button. DO NOT MISS THIS STEP!
    • From the "Services" MMC, restart "IIS Admin"
  • No labels