Linux下jsp環境:apache,tomcat配置
Linux下jsp開發環境,apache,tomcat伺服器配置過程:
(特別註明:本文內容均參考於網際網路,經過個人實踐而總結,若配置中遇到問題請聯絡我,可能寫的時候漏掉了某些地方,感謝網上前輩的經驗,希望更多的實踐經驗得以共享)
1.作業系統
RedHat Linux 9.0
2.所需軟體
Apache 2.0.54
下載地址
下載該檔案httpd-2.0.54.tar.gz
Tomcat5.5.9
下載地址
下載該檔案jakarta-tomcat-5.5.9.tar.gz
Mod_jk 1.2.14
下載地址
下載該檔案jakarta-tomcat-connectors-1.2.14-src.tar.gz
Jdk 1_5_0_04
下載地址
下載該檔案jdk-1_5_0_04-linux-i586-rpm.bin
下載時將所需軟體包檔案儲存在/usr/local目錄下
3.安裝步驟
A 安裝JDK
# cd /usr/local/
# chmod +x jdk-1_5_0_04-linux-i586-rpm.bin
# ./jdk-1.5.0_04-linux-i586-rpm.bin
# cd /usr/java/
# ln -s /usr/java/jdk-1_5_0_04 /usr/local/java
# vi /etc/profile
#
新增如下內容
JAVA_HOME=/usr/java/jdk-1_5_0_04
CLASSPATH=/usr/java/jdk-1_5_0_04/lib/dt.jar:/usr/java/jdk-1_5_0_04/lib/tools.jar
PATH=/usr/java/jdk-1_5_0_04/bin:$PATH
export PATH JAVA_HOME CLASSPATH
B 安裝Apache
# cd /usr/local/
# tar xvfz httpd-2.0.54.tar.gz
# cd httpd-2.0.54
# ./configure --prefix=/usr/local/apache --enable-module=so
# make
# make install
# cd /usr/local/apache/conf
# vi ./httpd.conf
將Listen 80 修改為Listen 127.0.0.1:80 (219行)
將ServerName 修改為ServerName LocalHost:80 (291行)
在DirectoryIndex中新增 index.jsp (394行)
# cd /usr/local/apache/bin/
# ./apachectl configtest
顯示Syntax ok則表明安裝成功
#./apachectl start
啟動apache服務,瀏覽器中訪問本機80埠,檢視埠是否正常,輸入127.0.0.1:80
# ./apachectl stop
關閉服務
備註:prefix定義apache的安裝路徑
C安裝Tomcat
# cd /usr/local/
# tar xvfz jakarta-tomcat-5.5.9.tar.gz
# ln ?s /usr/local/jakarta-tomcat-5.5.9 /usr/local/tomcat
# vi /usr/local/tomcat/bin/catalina.sh
第46行加入此句
JAVA_HOME=/usr/java/jdk-1_5_0_04
啟動服務後,訪問本機8080埠,檢視埠是否正常(輸入127.0.0.1:8080)
# /usr/local/tomcat/bin/startup.sh /startup.bat
關閉服務
# /usr/local/tomcat/bin/shutdown.sh /shutdown.bat
D 安裝JK
# cd /usr/local/
# tar xzvf jakarta-tomcat-connectors-1.2.14-src.tar.gz
# cd jakarta-tomcat-connectors-1.2.14-src/jk/native
# chmod 755 buildconf.sh
# ./buildconf.sh
# ./configure --with-apxs=/usr/local/apache/bin/apxs
# make
# make install
# cd /usr/local/jakarta-tomcat-connectors-jk1.2.14-src/jk/native/apache-2.0/
# cp mod_jk.so /usr/local/apache/modules/
E 系統整合
# vi /usr/local/apache/conf/httpd.conf
在檔案最末尾加上如下語句
#Load mod_jk
LoadModule jk_module modules/mod_jk.so
# Configure mod_jk
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel info
JkMount /*.jsp loadbalancer
JkMount /servlet/* loadbalancer
JkMount /application/* loadbalancer
#vi /usr/local/apache/conf/workers.properties
新增下列語句
#
# workers.properties
#
# In Unix, we use forward slashes:
ps=/
# list the workers by name
worker.list=tomcat1, tomcat2, loadbalancer
# ------------------------
# First tomcat server
# ------------------------
worker.tomcat1.port=8009
worker.tomcat1.host=127.0.0.1
worker.tomcat1.type=ajp13
# Specify the size of the open connection cache.
#worker.tomcat1.cachesize
#
# Specifies the load balance factor when used with
# a load balancing worker.
# Note:
# ----> lbfactor must be > 0
# ----> Low lbfactor means less work done by the worker.
worker.tomcat1.lbfactor=100
# ------------------------
# Second tomcat server
# ------------------------
worker.tomcat2.port=8009
worker.tomcat2.host=192.168.1.34
worker.tomcat2.type=ajp13
# Specify the size of the open connection cache.
#worker.tomcat2.cachesize
#
# Specifies the load balance factor when used with
# a load balancing worker.
# Note:
# ----> lbfactor must be > 0
# ----> Low lbfactor means less work done by the worker.
worker.tomcat2.lbfactor=100
# ------------------------
# Load Balancer worker
# ------------------------
# The loadbalancer (type lb) worker performs weighted round-robin
# load balancing with sticky sessions.
# Note:
# ----> If a worker dies, the load balancer will check its state
# once in a while. Until then all work is redirected to peer
# worker.
worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=tomcat1, tomcat2
#
# END workers.properties
#
#vi /usr/local/tomcat/conf/server.xml
protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"
redirectPort="8443" protocol="AJP/1.3" /> 第101行
在119行左右加入如下語句(去註釋)
若第二臺tomcat,將jvmRoute的修改為tomcat2
系統整合完畢
啟動apache和tomcat服務
# /usr/local/apache/bin/apachectl start
# /usr/local/tomcat/bin/catalina.sh start
將如下內容新增至/etc/rc.d/rc.local檔案末尾
以便系統啟動後開啟apache,tomcat服務
#vi /etc/rc.d/rc.local
新增
/usr/local/tomcat/bin/catalina.sh start
/usr/local/apache/bin/apachectl start[@more@]
(特別註明:本文內容均參考於網際網路,經過個人實踐而總結,若配置中遇到問題請聯絡我,可能寫的時候漏掉了某些地方,感謝網上前輩的經驗,希望更多的實踐經驗得以共享)
1.作業系統
RedHat Linux 9.0
2.所需軟體
Apache 2.0.54
下載地址
下載該檔案httpd-2.0.54.tar.gz
Tomcat5.5.9
下載地址
下載該檔案jakarta-tomcat-5.5.9.tar.gz
Mod_jk 1.2.14
下載地址
下載該檔案jakarta-tomcat-connectors-1.2.14-src.tar.gz
Jdk 1_5_0_04
下載地址
下載該檔案jdk-1_5_0_04-linux-i586-rpm.bin
下載時將所需軟體包檔案儲存在/usr/local目錄下
3.安裝步驟
A 安裝JDK
# cd /usr/local/
# chmod +x jdk-1_5_0_04-linux-i586-rpm.bin
# ./jdk-1.5.0_04-linux-i586-rpm.bin
# cd /usr/java/
# ln -s /usr/java/jdk-1_5_0_04 /usr/local/java
# vi /etc/profile
#
新增如下內容
JAVA_HOME=/usr/java/jdk-1_5_0_04
CLASSPATH=/usr/java/jdk-1_5_0_04/lib/dt.jar:/usr/java/jdk-1_5_0_04/lib/tools.jar
PATH=/usr/java/jdk-1_5_0_04/bin:$PATH
export PATH JAVA_HOME CLASSPATH
B 安裝Apache
# cd /usr/local/
# tar xvfz httpd-2.0.54.tar.gz
# cd httpd-2.0.54
# ./configure --prefix=/usr/local/apache --enable-module=so
# make
# make install
# cd /usr/local/apache/conf
# vi ./httpd.conf
將Listen 80 修改為Listen 127.0.0.1:80 (219行)
將ServerName 修改為ServerName LocalHost:80 (291行)
在DirectoryIndex中新增 index.jsp (394行)
# cd /usr/local/apache/bin/
# ./apachectl configtest
顯示Syntax ok則表明安裝成功
#./apachectl start
啟動apache服務,瀏覽器中訪問本機80埠,檢視埠是否正常,輸入127.0.0.1:80
# ./apachectl stop
關閉服務
備註:prefix定義apache的安裝路徑
C安裝Tomcat
# cd /usr/local/
# tar xvfz jakarta-tomcat-5.5.9.tar.gz
# ln ?s /usr/local/jakarta-tomcat-5.5.9 /usr/local/tomcat
# vi /usr/local/tomcat/bin/catalina.sh
第46行加入此句
JAVA_HOME=/usr/java/jdk-1_5_0_04
啟動服務後,訪問本機8080埠,檢視埠是否正常(輸入127.0.0.1:8080)
# /usr/local/tomcat/bin/startup.sh /startup.bat
關閉服務
# /usr/local/tomcat/bin/shutdown.sh /shutdown.bat
D 安裝JK
# cd /usr/local/
# tar xzvf jakarta-tomcat-connectors-1.2.14-src.tar.gz
# cd jakarta-tomcat-connectors-1.2.14-src/jk/native
# chmod 755 buildconf.sh
# ./buildconf.sh
# ./configure --with-apxs=/usr/local/apache/bin/apxs
# make
# make install
# cd /usr/local/jakarta-tomcat-connectors-jk1.2.14-src/jk/native/apache-2.0/
# cp mod_jk.so /usr/local/apache/modules/
E 系統整合
# vi /usr/local/apache/conf/httpd.conf
在檔案最末尾加上如下語句
#Load mod_jk
LoadModule jk_module modules/mod_jk.so
# Configure mod_jk
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel info
JkMount /*.jsp loadbalancer
JkMount /servlet/* loadbalancer
JkMount /application/* loadbalancer
#vi /usr/local/apache/conf/workers.properties
新增下列語句
#
# workers.properties
#
# In Unix, we use forward slashes:
ps=/
# list the workers by name
worker.list=tomcat1, tomcat2, loadbalancer
# ------------------------
# First tomcat server
# ------------------------
worker.tomcat1.port=8009
worker.tomcat1.host=127.0.0.1
worker.tomcat1.type=ajp13
# Specify the size of the open connection cache.
#worker.tomcat1.cachesize
#
# Specifies the load balance factor when used with
# a load balancing worker.
# Note:
# ----> lbfactor must be > 0
# ----> Low lbfactor means less work done by the worker.
worker.tomcat1.lbfactor=100
# ------------------------
# Second tomcat server
# ------------------------
worker.tomcat2.port=8009
worker.tomcat2.host=192.168.1.34
worker.tomcat2.type=ajp13
# Specify the size of the open connection cache.
#worker.tomcat2.cachesize
#
# Specifies the load balance factor when used with
# a load balancing worker.
# Note:
# ----> lbfactor must be > 0
# ----> Low lbfactor means less work done by the worker.
worker.tomcat2.lbfactor=100
# ------------------------
# Load Balancer worker
# ------------------------
# The loadbalancer (type lb) worker performs weighted round-robin
# load balancing with sticky sessions.
# Note:
# ----> If a worker dies, the load balancer will check its state
# once in a while. Until then all work is redirected to peer
# worker.
worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=tomcat1, tomcat2
#
# END workers.properties
#
#vi /usr/local/tomcat/conf/server.xml
protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"
redirectPort="8443" protocol="AJP/1.3" /> 第101行
在119行左右加入如下語句(去註釋)
若第二臺tomcat,將jvmRoute的修改為tomcat2
系統整合完畢
啟動apache和tomcat服務
# /usr/local/apache/bin/apachectl start
# /usr/local/tomcat/bin/catalina.sh start
將如下內容新增至/etc/rc.d/rc.local檔案末尾
以便系統啟動後開啟apache,tomcat服務
#vi /etc/rc.d/rc.local
新增
/usr/local/tomcat/bin/catalina.sh start
/usr/local/apache/bin/apachectl start[@more@]
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7507082/viewspace-869054/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Windows環境下的tomcat+apache配置WindowsTomcatApache
- Tomcat下JSP、Servlet和JavaBean環境的配置TomcatJSServletJavaBean
- Apache與Tomcat4整合構建jsp環境(轉)ApacheTomcatJS
- tomcat下配置https環境TomcatHTTP
- UNIX下的PHP環境配置,+apache (轉)PHPApache
- linux下jsp環境的搭建薦LinuxJS
- Apache Thrift 配置環境和執行(Linux)ApacheLinux
- LAMP環境(linux+apache+mysql+php)配置LAMPLinuxApacheMySqlPHP
- windows環境下Resin和apache的配置薦WindowsApache
- linux下配置java環境LinuxJava
- Linux環境下Apache ActiveMQ 基本安裝LinuxApacheMQ
- Tomcat的下載及環境變數配置Tomcat變數
- tomcat+mysql部署jsp環境!!!!(轉)TomcatMySqlJS
- Linux 下配置 node + mongodb 環境LinuxMongoDB
- linux環境下ssh 互信配置Linux
- Linux環境下Swap配置方法Linux
- JDK Tomcat MySQL環境配置JDKTomcatMySql
- 求救~~~~~tomcat+mysql部署jsp環境!!!!!(轉)TomcatMySqlJS
- Linux環境下Spring Boot專案內建Tomcat引數配置LinuxSpring BootTomcat
- solaris10-x86下快速配置apache與tomcat整合支援jspApacheTomcatJS
- Windows7環境下Apache+PHP+MySQL完美配置WindowsApachePHPMySql
- Linux環境下nginx安裝配置LinuxNginx
- oracle linux環境下hostonly模式配置OracleLinux模式
- linux jdk ,tomcat 安裝與環境變數配置LinuxJDKTomcat變數
- solaris10-x86下快速配置apache與tomcat整合支援jsp(轉)ApacheTomcatJS
- 在linux環境下安裝JDK並配置環境變數LinuxJDK變數
- Linux CentOS 7 下 Apache Tomcat 7 安裝與配置(心得)LinuxCentOSApacheTomcat
- Linux環境配置Linux
- DM8 Linux環境下配置ODBCLinux
- Linux下Java環境變數的配置LinuxJava變數
- Win98下安裝JSP環境(tomcat-4.0.1 在 jdk1.3.1 下) (轉)JSTomcatJDK
- JDK環境配置 maven環境配置 eclipse關聯+maven+svn+tomcatJDKMavenEclipseTomcat
- Ubuntu環境下配置J2EE開發環境jdk+tomcat+mysql+myeclipseUbuntu開發環境JDKTomcatMySqlEclipse
- win98下配置jsp的執行環境實踐 (轉)JS
- Centos x64 6.2配置JSP環境CentOSJS
- 新手入門經典:Jsp環境配置JS
- Unix環境中配置JSP的方法(轉)JS
- Linux系統下CUDA和cuDNN環境配置LinuxDNN