1. Prepare and download the required files. It is assumed that JDK has been correctly installed and configured.
Download the required files from the Apache Official Website:
Httpd-2.2.0.tar.gz
Apache-tomcat-5.5.12.tar.gz
Jakarta-tomcat-connectors-1.2.15-src.tar.gz
Httpd and Jakarta-Tomcat-connectors are source code packages and APACHE-Tomcat are Binary packages.
2. install Apache.
Code :
# Tar xzvf httpd-2.2.0.tar.gz
# Cd httpd-2.2.0
#./Configure -- prefix =/usr/local/apache2 -- enable-so
# Make
# Make install
3. install Tomcat.
Code:
# Cp apache-tomcat-5.5.12.tar.gz/usr/local/
# Cd/usr/local
# Tar xzvf apache-tomcat-5.5.12.tar.gz
# Ln-s APACHE-Tomcat-5.5.12 Tomcat
4. compile and generate mod_jk.
Code:
# Tar xzvf jakarta-tomcat-connectors-1.2.15-src.tar.gz
# Cd jakarta-tomcat-connectors-1.2.15-src/JK/native
#./Configure -- With-apxs =/usr/local/apache2/bin/apxs
# Make
# Cp./Apache-2.0/mod_jk.so/usr/local/apache2/modules/
5. configuration.
Create two configuration files mod_jk.conf and workers. properties under/usr/local/apache2/CONF.
#
VI mod_jk.conf
Add the following content:
Code:
# Indicates the work required for the mod_jk ModuleCompositionLocation of workers. Properties
Jkworkersfile/usr/local/apache2/CONF/workers. Properties
# Where to put JK logs
Jklogfile/usr/local/apache2/logs/mod_jk.log
# Set the jk log level [debug/error/info]
Jkloglevel info
# Select the log format
Jklogstampformat "[% A % B % d % H: % m: % S % Y]"
# Jkoptions indicate to send SSL key size,
Jkoptions + forwardkeysize + forwarduricompat-forwarddirectories
# Jkrequestlogformat set the request format
Jkrequestlogformat "% w % v % t"
# Send all Servlet and JSP requests to Tomcat through the ajp13 protocol for Tomcat to process
Jkmount/servlet/* worker1
Jkmount/*. jsp worker1
# Vi workers. Properties
Add the following content:
Code:
# Defining a worker named worker1 and of Type ajp13
Worker. List = worker1
# Set Properties for worker1
Worker. worker1.type = ajp13
Worker. worker1.host = localhost
Worker. worker1.port = 8009
Worker. worker1.lbfactor = 50
Worker. worker1.cachesize = 10
Worker. worker1.cache _ timeout = 600
Worker. worker1.socket _ keepalive = 1
Worker. worker1.socket _ timeout = 300
Configure httpd. conf and make the following changes:
Set listen
80 to listen 127.0.0.1: 80
Change servername to servername
Localhost: 80
Add in directoryindex
Index. jsp
My webpage is stored in/var/wwwroot, So modify DocumentRoot
Code:
DocumentRoot "/var/wwwroot"
<Directory "/var/wwwroot">
Options shortdes followsymlinks
AllowOverride none
Order deny, allow
Allow from all
Xbithack on
</Directory>
<Directory "/var/wwwroot/WEB-INF">
Order deny, allow
Deny from all
</Directory>
Add the statement about loading mod_jk:
Code:
Loadmodule jk_module modules/mod_jk.so
Include/usr/local/apache2/CONF/mod_jk.conf
Finally, edit the tomcat configuration file server. xml and add the following to the host segment:
Code:
<Context Path = "" docbase = "/var/wwwroot" DEBUG = "0" reloadable = "true" crosscontext = "true"/>
Create an index. jsp under/var/wwwroot, start Apache and tomcat, and access http: // localhost/in a browser. The correct page is displayed.