Integrate RH3 + TOMCAT5 + APACHE2 + jk2

Source: Internet
Author: User
Article title: integrate RH3 + TOMCAT5 + APACHE2 + jk2. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Running environment: RedHat Enterprise 3.0
  
   1. Instructions
The purpose of this article is to integrate Apache and Tomcat with JK2 in the RH3 environment, without involving virtual hosts or PHP. the following steps may not be necessary.
  
Version:
Apache: 2.0.49
Tomcat: 5.0.19
Jk2: 2.0.4
J2sdk: 1.4.2.04
  
Download File: httpd-2.0.49.tar.gz
Jakarta-tomcat-5.0.19.tar.gz
Jakarta-tomcat-connectors-jk2-src-current.tar.gz
J2sdk-1_4_2_04-linux-i586.bin
  
Installation Path:
Apache->/usr/local/httpd-2.0.49
Tomcat->/usr/local/jakarta-tomcat-5.0.19
J2sdk->/usr/local/j2sdk1.4.2 _ 04
Jk2->/usr/local/jakarta-tomcat-connectors-jk2-2.0.4-src
Create a soft link:
Ln-s/usr/local/jakarta-tomcat-5.0.19/usr/local/tomcat
Ln-s/usr/local/httpd-2.0.49/usr/local/apache
Ln-s/usr/local/j2sdk1.4.2 _ 04/usr/local/jdk
  
Location of the configuration file:
Httpd. conf->/usr/local/apache/conf/httpd. conf
Workers2.properties->/usr/local/apache/conf/workers2.properties
Server. xml->/usr/local/tomcat/conf/server. xml
Jk2.properties->/usr/local/tomcat/conf/jk2.properties
  
   II. installation steps
JDK: rps-ivh j2sdk-1_4_2_03-linux-i586.rpm
Apache: tar xvfz httpd-2.0.49.tar.gz
Cd httpd-2.0.47
./Configure -- prefix =/usr/local/apache -- enable-so
Make
Make install
(Note: No Web service is installed when RH3 is installed)
  
Tomcat: tar xvfz jakarta-tomcat-5.0.19.tar.gz
  
Edit the file/usr/local/tomcat/bin/catalina. sh
Insert the following lines after the comment line:
JAVA_HOME =/usr/local/jdk/
CATALINA_HOME = "/usr/local/tomcat /"
JAVA_OPTS = "-Xms256m-Xmx256m"
Add users and groups:
Groupadd tomcat
Useradd-g tomcat-c "Tomcat User"-d/usr/local/tomcat
Chown-R tomcat: tomcat/usr/local/tomcat
Chown-R tomcat: tomcat/usr/local/jakarta-tomcat-5.0.19
Mkdir/usr/local/tomcat/webapps/mylog
  
JK2: tar xvfz jakarta-tomcat-connectors-jk2-src-current.tar.gz
Cd jakarta-tomcat-connectors-jk2-2.0.4-src/jk/native2
Chmod 755 buildconf. sh
./Buildconf. sh
./Configure -- with-apxs2 =/usr/local/apache/bin/apxs \
---- With-apr-lib =/usr/local/apache/lib \
-- With-tomcat-41 =/usr/local/tomcat \
-- With-java-home =/usr/local/jdk \
-- With-jni
Make
Libtool -- finish/usr/local/apache/httpd/modules
Cd jakarta-tomcat-connectors-jk2-2.0.4-src/jk/build/jk2/apache2
Cp mod_jk2.so/usr/local/apache/modules/
Cp libjkjni. so/usr/local/apache/modules/
  
Cd/usr/local/tomcat/logs
Touch jk2.shm
Usermod-G apache, tomcat apache
  
When running at startup, edit the file:/etc/rc. d/rc. local and add the following two rows:
Su-tomcat-c/usr/local/tomcat/bin/startup. sh
/Usr/local/apache/bin/apachectl start
  
   3. modify the configuration file. if the configuration file does not exist, create it.
Httpd. conf:
Comment out the adddefacharcharset row
Added: LoadModule jk2_module modules/mod_jk2.so
Workers2.properties:
# Only at beginnin. In production uncomment it out
[Logger. apache2]
Level = DEBUG
  
[Shm]
File =/usr/local/apache/logs/shm. file
Size = 1048576
  
# Example socket channel, override port and host.
[Channel. socket: localhost: 8009]
Info = Ajp13 forwarding over socket
TomcatId = localhost: 8009
  
# Define the workUntitled 1er
[Ajp13: localhost: 8009]
Channel = channel. socket: localhost: 8009
  
[Uri:/jsp-examples/*]
Info = Map the jsp-examples webapp
Worker = ajp13: localhost: 8009
  
[Uri:/servlets-examples/*]
Info = Map the servlets-examples webapp
Worker = ajp13: localhost: 8009
Jk2.properties:
# This file may be overriden at runtime. MAKE SURE TOMCAT IS STOPED
# When you edit the file.
  
# Comments will be _ LOST _
  
# Documentation of the format in JkMain javadoc.
  
# Set the desired handler list
# Handler. list = apr, request, channelJni
Handler. list = channelSocket, request
#
# Override the default port for the socketChannel
# Channel socket. port = 8019
ChannelSocket. port = 8009
# Default:
# ChannelUnix. file =$ {jkHome}/work/jk2.socket
# Just to check if the config is working
# Shm. file =$ {jkHome}/work/jk2.shm
  
# In order to enable jni use any channelJni direve ve
# ChannelJni. disabled = 0
# And one of the following ctictives:
  
# Apr. jniModeSo =/opt/apache2/modules/mod_jk2.so
  
# If set to inprocess the mod_jk2 will Register natives itself
# This will enable the starting of the Tomcat from mod_jk2
# Apr. jniModeSo = inprocess
Server. xml:
  
   Debug = "0"/>
   Debug = "0"/>
  
  
  
  
  
  
  
  
   Type = "org. apache. catalina. UserDatabase"
Description = "User database that can be updated and saved">
  
  
  
   Factory
   Org. apache. catalina. users. MemoryUserDatabaseFactory
  
  
   Pathname
   Conf/tomcat-users.xml
  
  
  
  
  
  
   MaxThreads = "150" minSpareThreads = "25" maxSpareThreads = "75"
EnableLookups = "false" redirectPort = "8443" acceptCount = "100"
Debug = "0" connectionTimeout = "20000"
DisableUploadTimeout = "true"/>
  
  
   EnableLookups = "false" redirectPort = "8443" debug = "0"
Protocol = "AJP/1.3" type = "codeph" text = "/codeph"/>
  
  
  
  
  
   Prefix = "catalina_log." suffix = ". txt"
Timestamp = "true"/>
  
  
  
  
   Debug = "0" resourceName = "UserDatabase"/>
  
   UnpackWARs = "true" autoDeploy = "true"
XmlValidation = "false" xmlNamespaceAware = "false">
  
   Directory = "logs" prefix = "localhost_log." suffix = ". txt"
Tim
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.