Apache2.2.11 + tomcat6.0.18 + jdk-6u12 + Tomcat-connectors-1.2.27

Source: Internet
Author: User


[Root @ localhost Tomcat] # cp jdk-6u12-linux-i586.bin/usr/local/
[Root @ localhost Tomcat] # cp apache-tomcat-6.0.18.tar.gz.gz/usr/local/
[Root @ localhost Tomcat] # cp httpd-2.2.11.tar.gz/usr/local/
[Root @ localhost Tomcat] # cd/usr/local/
All packages are in this directory

[Root @ localhost local] # ll
-RW-r -- 1 Root 6142197 Feb 27 apache-tomcat-6.0.18.tar.gz.gz
-RW-r -- 1 Root 6806786 Feb 27 httpd-2.2.11.tar.gz
-Rwxr-XR-x 1 Root 80105323 Feb 27 jdk-6u12-linux-i586.bin
-RW-r -- 1 Root 1509182 Feb 27 tomcat-connectors-1.2.27-src.tar.gz

Step 1: Install JDK
CD/usr/local
[Root @ localhost local] # chmod 755 jdk-6u11-linux-i586-rpm.bin
[Root @ localhost local] #./jdk-6u11-linux-i586-rpm.bin
Enter yes once in the middle and click Enter once
The installation is successful. The Directory of/usr/Java/jdk1.6.0 _ 12 is displayed.

Configure environment variables: CP/etc/profile. Bak
Vim/etc/profile
Add at the end:
# Add By sunyankui for JDK
Export java_home =/usr/local/jdk1.6.0 _ 12
Export java_bin =/usr/local/jdk1.6.0 _ 12/bin
Export Path = $ path: $ java_home/bin
Export calsspath = $ java_home/lib/dt. jar: $ java_home/lib/tools. Jar
Export java_home java_bin path calsspath

Make it take effect: Source/etc/profile

Step 2: install Tomcat
CD/usr/local
[Root @ localhost local] # tar xvfz apache-tomcat-6.0.18.tar.gz

Start Tomcat:/usr/local/tomcat6/bin/startup. Sh
Stop Tomcat:/usr/local/tomcat6/bin/shutdown. Sh

Step 3: install Apache
CD/usr/local
[Root @ localhost local] # tar xvfz httpd-2.2.11.tar.gz
CD httpd-2.2.11/
Mkdir/usr/local/apache2
./Configure -- prefix =/usr/local/apache2 -- enable-so
Make
Make install
Installation complete!

Tomcat6.0.18 + apache2.2.11 integration started.

The first step is to modify the global configuration file httpd. conf.
CD/usr/local/apache2/CONF/
Cp http. conf HTTP. conf. Bak
Vim HTTP. conf
Servername: 127.0.0.1: 80, Server IP address or domain name

Define index.htm index. jsp in directoryindex
: WQ: Save and exit
Now you can start the apache2.0 server.
Use:/usr/local/apache2/bin/apachectl start
Input: http: // 127.0.0.1/
You will see it works!
This interface is successfully tested.
Start Tomcat with:/usr/local/tomcat6/bin/startup. Sh
Input: http: // 127.0.0.1: 8080/
You will see the Tomcat test page

Step 2: Download and compile the connection file mod_jk.so to connect tomcat to Apache.
The source code installation package is also downloaded on the http://tomcat.apache.org site: tomcat-connectors-1.2.27-src.tar.gz

CD/usr/local
[Root @ localhost local] # tar xvfz tomcat-connectors-1.2.27-src.tar.gz
CD tomcat-connectors-1.2.27-src/
There is a build.txt inside. Read it carefully.
Then cd native/
Vim building.txt read it carefully
Enter./configure -- With-apxs =/usr/local/apache2/bin/apxs -- With-Java-home =/usr/Java/jdk1.6.0 _ 12
Make
Cp apache-2.0/mod_jk.so/usr/local/apache2/modules/
This step is important

Step 3: create two configuration files mod_jk.conf and workers. properties under/usr/local/apache2/CONF.
Vim mod_jk.conf
Add the following code:
# 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 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


Vim workers. Properties
Add the following 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:
Change Listen 80 to listen 127.0.0.1: 80
Change servername to servername localhost: 80

My webpage is stored in/var/wwwroot, So modify DocumentRoot

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:
Add 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:
<Context Path = "" docbase = "/var/wwwroot"
DEBUG = "0" reloadable = "true" crosscontext = "true"/>

Similar to the following:
<! -- Define the default Virtual Host
Note: The XML Schema validation will not work with xerces 2.2.
-->
<Host name = "localhost" appbase = ""
Unpackwars = "true" autodeploy = "true"
Xmlvalidation = "false" xmlnamespaceaware = "false">
<Context Path = "" docbase = "/var/wwwroot"
DEBUG = "0" reloadable = "true" crosscontext = "true"/>


<! -- Singlesignon valve, share authentication between Web Applications
Documentation at:/docs/config/valve.html -->

 

Create a test. jsp under/var/wwwroot, start Apache and tomcat, and access http: // localhost/in a browser. The correct page should be displayed.

Example of test. jsp
Hello! The time is <% = new java. util. Date () %>


Enter http: // 127.0.0.1/test. jsp
You will see: Hello! The time is mon Jan 19 19 21:29:38 CST 2009
OK, you have succeeded.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.