User loginRecommended Books |
Integrating Tomcat and Apache TogetherIntroductionHere are quick and easy instructions to integrating Tomcat and Apache together in Linux that allows the :8080 (or other port number) to not show in the URL. I have seen other how-to's about this, but they always over complicate the instructions or they're missing vital steps. PrerequisitesThe steps in this article have been tested with the following versions:
The following are assumed:
mod_jk
workers.properties File
tomcat.conf FileI like to keep specific configurations of components of apache separated. Here, I have created a file called tomcat.conf which is loaded by apache2.conf (or httpd.conf) file during initial startup. Here is the contents of tomcat.conf (tailor it to suit your system): ###################################################################### # Allows apache and tomcat to work together. # # Load mod_jk module. LoadModule jk_module /usr/lib/apache2/modules/mod_jk-1.2.27.so # Where to find workers.properties JkWorkersFile /etc/apache2/workers.properties # Where to put jk logs JkLogFile /var/log/apache2/mod_jk.log # Set the jk log level [debug/error/info] JkLogLevel error # Select the log format JkLogStampFormat "[%a %b %d %H:%M:%S %Y] " # JkRequestLogFormat set the request format JkRequestLogFormat "%w %V %T" # JkOptions JkOptions +ForwardKeySize -ForwardDirectories ###################################################################### An explanation of each of the jk options can be found here: Apache jk Options. Virtual Host FileThis is probably the most vital step that is missing in a lot of how-to's. The JkMount directive must be added to the virtual host file containing port 80. The virtual host definition may also be present in your apache2.conf or httpd.conf file. If not, create a new file called something like default.conf, add the contents below, and put default.conf somewhere in which it can be properly loaded by apache2.conf (or httpd.conf). <VirtualHost *:80> ServerName your.hostname.com # Send servlet for context /jsp-examples to worker named worker1 JkMount /jsp-examples worker1 # Send JSPs for context /jsp-examples/* to worker named worker1 JkMount /jsp-examples/* worker1 </VirtualHost> Test ItTo test your setup, type http://localhost/jsp-examples. It should also work with http://localhost:8080/jsp-examples. |
SyndicationWho's onlineThere are currently 0 users and 2 guests online.
Who's new
Find a Linux BookHelp Support This Site |