1. Prepare and download the required files. It is assumed that JDK has been correctly installed and configured. Download the required files to the Apache Official Website: httpd-2.2.0.tar.gzapache-tomcat-5.5.12.tar.gzjakarta-tomcat-connectors-1.2.15-src.tar.gz, httpd and jakarta-tomcat-connectors for the source package, apache
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-McAt-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.
# Tar xzvf httpd-2.2.0.tar.gz
#CdHttpd-2.2.0
#./Configure -- prefix =/usr/local/apache2 --Enable-So
# Make
# Make install
3. install Tomcat.
#CpApache-tomcat-5.5.12.tar.gz/usr/local/
# Cd/usr/local
# Tar xzvfapache-tomcat-5.5.12.tar.gz
#Ln-Sapache-tomcat-5.5.12 tomcat
4. compile and generate mod_jk.
# Tar xzvfjakarta-tomcat-connectors-1.2.15-src.tar.gz
# Cdjakarta-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:
# Point out the location of the workers. properties file required for mod_jk module work
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 tosend ssl key size,
JkOptions + ForwardKeySize + ForwardURICompat-ForwardDirectories
# JkRequestLogFormatSetThe 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:
# Defining a worker namEdWorker1 and of type ajp13
Worker. list = worker1
# Set properties forworker1
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:
Change Listen80 to Listen 127.0.0.1: 80
Change ServerName to ServerName LocalHost: 80
In DirectoryIndExAdd index. jsp
My webpage is stored in/var/wwwroot, So modify DocumentRoot
DocumentRoot "/var/wwwroot" Options I NcLudes FollowSymLinks AllowOverr IdE None Order deny, allow Allow from all XBitHack on Order deny, allow Deny from all |
Add the statement about loading mod_jk:
LoadModule jk_modulemodules/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:
Create an index. jsp under/var/wwwroot, start Apache and Tomcat, and access http: // localhost/in a browser. The correct page is displayed.