Configuration implementation of Apache+tomcat under Linux

Source: Internet
Author: User

Configuration of the Apache-tomcat
Download the package first
Apache-tomcat-6.0.33.tar.gz tomcat-connectors-1.2.32-src.tar.gz
Httpd-2.2.17.tar.gz Jdk-6u25-linux-i586-rpm.bin

1. Installation jdk
chmod +x jdk-6u25-linux-i586.bin 
./jdk-6u25-linux-i586.bin
mkdir/usr/java
MV jdk1.6.0_25//usr/java/
setting environment variables
vi/etc/profile added at the end:
export JAVA_HOME=/ USR/JAVA/JDK1.6.0_25
export classpath= $CLASSPATH: $JAVA _home/lib: $JAVA _home/ JRE/LIB
export path= $JAVA _home/bin: $JAVA _home/jre/bin: $PATH: $HOMR/bin

Source/etc/profile make settings effective immediately

2. Installing Apache
TAR-XVF httpd-2.2.17.tar.gz
CD httpd-2.2.17
./configure--prefix=/usr/local/apache--enable-so
Make;make Install

3. Installation tomcat
TAR-XVF apache-tomcat-6.0.33.tar.gz-c/usr/local /
cd/usr/local/
LN-SV APACHE-TOMCAT-6.0.33/TOMCAT6
vi tomcat6/bin/setenv.sh If you do not have this file manually establish
java_home=/usr/java/jdk1.6.0_25
kre_home=/usr/java/jdk1.6.0_25/ JRE
Create a user that can be managed via Web page login, create user to uninstall <!--... > outside
vi/usr/local/tomcat6/conf/tomcat-users.xml 
<user Username= "Michael" password= "123456" roles= "Manager,admin"/>

Test Tomcat Installation http://localhost:8080

4. Connect Apache and Tomcat
1) Compile Build mod_jk.so
TAR-XVF tomcat-connectors-1.2.32-src.tar.gz
CD tomcat-connectors-1.2.32-src/native
./configure--with-apxs=/usr/local/apache/bin/apxs--with-java-home=/usr/java/jdk1.6.0_25/
Make;make Install

Verification: mod_jk.so module generation should be visible in ls/usr/local/apache/modules/
2) Let Apache support JK module
Vi/usr/local/apache/conf/httpd.conf
DirectoryIndex index.jsp index.html
LoadModule Jk_module modules/mod_jk.so
Include conf/extra/mod_jk.conf

Vi/usr/local/apache/conf/extra/mod_jk.conf

# indicate the location of the working file Workers.properties required for the MOD_JK module to 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 through AJP13 's protocol to Tomcat and let tomcat> handle
jkmount/servlet/* Worker1
Jkmount/*.jsp Worker1
Jkmount *.do Worker1
AddType application/x-jsp. jsp

Vi/usr/local/apache/conf/workers.properties

# 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

3" modify Tomcat and Apache to point to the same Web root directory
vi/usr/local/tomcat6/conf/ SERVER.XML&NBSP;
<context path= "docbase="/usr/local/apache/htdocs "
      debug=" 0 "reloadable=" true "crosscontext=" true "/>

Create a test page below the Apache Web root directory
<body>
<%=new Java.util.Date ()
%>
</body>

Configuration implementation of Apache+tomcat under Linux

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.