Server environment:
Redhat Linux 8.0
J2SDK1.4.1_02
Tomcat 5.0.12 binary
Apache 2.0.47 Built from Source
JK2 Connector Source from jakarta.apache.org
Install JDK:
Download: J2SDK-1_4_1_02-Linux-i586.bin
Install JDK in /usr/local/j2sdk1.4.1_02
Create soft connection JDK under / usr / local
#LN -S /USR / LOCAL/J2SDK1.4.1_02 / usr / local / jdk
[User @ host] # cat /etc/profile.d/java.sh
# set java environment
Export java_home = / usr / local / jdk
Export Path = $ PATH: $ java_home / bin
Export ClassPath = $ java_home / lib
# Change the shell file properties:
#CHMOD 755 / Etc/profile.d/java.sh
# View if it is correct
#ewhich java
/ usr / local / jdk / bin / java
Install Apache:
#CD / USR / Local / SRC /
#tar -xzvf httpd-2.0.47.tar.gz
#CD httpd-2.0.47
# Configure Apache Support Dynamic Module Load
#. / configure /
"--with-layout = apache" /
"--PREFIX = / usr / local / apache" /
"--enable-module = so" /
"--enable-module = setENVIF" /
"--enable-module = rebrite" /
"--with-mpm = prefork"
#make
#make install
# Modify HTTP.CONF specific modification, please refer to Apache 2.0 Documentation
# Or view http://www.cnfug.org/journal/3/02.html
STARTSERVERS 10
MinSpareServers 25
MaxSpareServers 50
ServerLimit 2000
MaxClients 1500 #apache can handle the request at the same time
MaxRequestsperChild 10000
Install PHP:
Download: PHP-4.3.3.tar.gz
#CD / USR / LOCAL / SRC
#tar -xzvf
#php for apache runs in the way Apache Modules
./configure --with-apxs2 = / usr / local / apache / bin / apxs
#php run like shell runs separate shell
./configure --prefix = / usr / local / php
#php for apache
./configure /
--with-apxs2 = / usr / local / apache / bin / apxs /
--enable-track-vars /
--enable-debug /
--enable-url-incrudes /
--enable-sockets /
--with-config-file-path = / usr / local / apache / conf # php.ini file directory
# The following parameters are installed on the PHP GD library.
--with-gd = / usr / local /
--enable-gd-native-ttf /
--with-TTF = / usr / local /
--with-jpeg-dir = / usr / local / - with-zlib-dir = / usr / local /
--with-png-dir = / usr / local
#make
#make install
#ls -l /usr/local/apache/modules/libphp4.so # There is a successful installation
# Modify Apache http.conf
Add to
LoadModule PHP4_Module Modules / Libphp4.so
AddType Application / X-httpd-php .php
Install Tomcat:
#CD / USR / LOCAL
#TAR -XZVF JAKARTA-TOMCAT-5.0.12.tar.gz
#LN-S Jakarta-Tomcat-5.0.12 Tomcat
# Test Tomcat Normal installation:
# / usr / local / tomcat / bin / startup.sh
#Nely Http: // Yourip: 8080 / Tomcat page normally displayed
Install JK2:
#CD / USR / LOCAL / SRC
#TAR -XZVF JAKARTA-TOMCAT-Connectors-JK2-2.0.2-src.tar.gz
#CD JAKARTA-TOMCAT-Connectors-JK2-2.0.2-SRC
#CD JK / NATIVE2
#Chmod 755 Buildconf.sh
#. / configure --with-apxs2 = / usr / local / apache / bin / apxs --enable-eAPI
#make
#make install
# If Make Install is unsuccessful, you need to send MOD_JK2.SO
#CD /usR/local/src/jakarta-tomcat-connectors-jk2-2.0.2-src/jk/build/jk2/apache2
#CP * .SO / USR / local / apache / modules /
Configuring $ CATLINA / CONF / Server.xml
Factory
Org.apache.catalina.users.MemoryUserDatabaseFactory
Pathname
Conf / tomcat-users.xml
#edit
#vi /usr/local/tomcat/conf/jk2.properties
# List of needed handlers.
Handler.list = ChannelSocket, Request
# Override the default port for the channelsocket
Channelsocket.port = 8009
# Edit the file:
#vi /usr/local/apache/conf/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]
Port = 8009
Host = 127.0.0.1
# Define the worker
[AJP13: Localhost: 8009]
Channel = CHANNEL.SOCKET: Localhost: 8009
# Uri mapping
[URI: 192.168.0.90 / *. jsp]
Worker = ajp13: Localhost: 8009
# Edit http.conf
#modify
Documentroot "/ usr / local / tomcat / webapps" # Add index.jsp
DirectoryIndex index.html index.html.var index.jsp
LoadModule JK2_Module Modules / MOD_JK2.SO
ORDER DENY, ALOW
Deny from all
#
# Order deny, allow
# Deny from all
#
ORDER ALOW, DENY
Servername www.home.net
Serveralias WWW
Serveralias Localhost
Serveralias 192.168.0.90
ServerAdmin webmater@xxx.com
Documentroot / WWW
Errorlog logs / home.net-errorlog
Customlog logs / home.net-access.log common
JKuriSet worker ajp13: localhost: 8009
# When configuring server.xml:
# Configure management port and connection port sequence upside down
# Observe at Catalina.out:
# When you connect with Apache, you don't have to wait.
# 修 修: /usr/local/tomcat/conf/catalina/localhost/manager.xml relative path change to an absolute path
# 修 修: /usr/local/tomcat/conf/catalina/localhost/admin.xml relative path change to an absolute path
# 修:: /usr/local/tomcat/conf/tomcat-users.xml Add Manager and Admin roles
# You can manage your own services via http: // uri: 8080 / manager / html http: // URI: 8080 / admin /
#Tomcat Men's default root is its "http:// URI /" WebApps
Tomcat Optimization:
modify:
Catalina.sh setting:
Java_opts = "- Server -XMX128M -XMS128M
Echo "Using Catalina_Base: $ CATALINA_BASE"
Echo "Using Catalina_Home: $ CATALINA_HOME"
Echo "Using Catalina_TMPDir: $ Catalina_TMPDIR"
Echo "Using Java_Home: $ java_home"
Echo "Using Java_OPTS: $ JAVA_OPTS
Parameter Description:
-server
Select The Java Hotspot Server VM.
-XMSN
Specify the initial size, in bytes, of the memory allocation pool. This value must be a multiple of 1024 greater than 1MB. Append the letter k or K to indicate kilobytes, or m or M to indicate megabytes. The default value is 2MB. EXAMPLES:
-XMS6291456
-XMS6144K
-XMS6M
-Xmxn
Specify the maximum size, in bytes, of the memory allocation pool. This value must a multiple of 1024 greater than 2MB. Append the letter k or K to indicate kilobytes, or m or M to indicate megabytes. The default value is 64MB. Examples : -Xmx83886080
-Xmx81920k
-Xmx80m
# When you add webApp, you need to establish web-inf / web.xml
# Otherwise, WebApp will be lost when you restart Tomcat every time you restart.