本篇內(nèi)容主要講解“Linux系統(tǒng)Jsp環(huán)境下Apache和Tomcat的配置”,感興趣的朋友不妨來看看。本文介紹的方法操作簡(jiǎn)單快捷,實(shí)用性強(qiáng)。下面就讓小編來帶大家學(xué)習(xí)“Linux系統(tǒng)Jsp環(huán)境下Apache和Tomcat的配置”吧!
目前累計(jì)服務(wù)客戶上1000+,積累了豐富的產(chǎn)品開發(fā)及服務(wù)經(jīng)驗(yàn)。以網(wǎng)站設(shè)計(jì)水平和技術(shù)實(shí)力,樹立企業(yè)形象,為客戶提供網(wǎng)站設(shè)計(jì)制作、網(wǎng)站設(shè)計(jì)、網(wǎng)站策劃、網(wǎng)頁(yè)設(shè)計(jì)、網(wǎng)絡(luò)營(yíng)銷、VI設(shè)計(jì)、網(wǎng)站改版、漏洞修補(bǔ)等服務(wù)。成都創(chuàng)新互聯(lián)始終以務(wù)實(shí)、誠(chéng)信為根本,不斷創(chuàng)新和提高建站品質(zhì),通過對(duì)領(lǐng)先技術(shù)的掌握、對(duì)創(chuàng)意設(shè)計(jì)的研究、對(duì)客戶形象的視覺傳遞、對(duì)應(yīng)用系統(tǒng)的結(jié)合,為客戶提供更好的一站式互聯(lián)網(wǎng)解決方案,攜手廣大客戶,共同發(fā)展進(jìn)步。1.操作系統(tǒng)
RedHat Linux 9.0
2.所需軟件
Apache 2.0.54
下載地址
http://apache.freelamp.com/httpd
下載該文件httpd-2.0.54.tar.gz
Tomcat5.5.9
下載地址
http://apache.justdn.org/jakarta/tomcat-5/v5.5.9/bin/
下載該文件jakarta-tomcat-5.5.9.tar.gz
Mod_jk 1.2.14
下載地址
http://apache.justdn.org/jakarta/tomcat-connectors/jk/source/jk-1.2.14/
下載該文件jakarta-tomcat-connectors-1.2.14-src.tar.gz
Jdk 1_5_0_04
下載地址
/tupian/20230522/ 下載該文件jdk-1_5_0_04-linux-i586-rpm.bin
下載時(shí)將所需軟件包文件保存在/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
#
添加如下內(nèi)容
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 修改為L(zhǎng)isten 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
啟動(dòng)apache服務(wù),瀏覽器中訪問本機(jī)80端口,查看端口是否正常,輸入127.0.0.1:80
# ./apachectl stop
關(guān)閉服務(wù)
備注: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
啟動(dòng)服務(wù)后,訪問本機(jī)8080端口,查看端口是否正常(輸入127.0.0.1:8080)
# /usr/local/tomcat/bin/startup.sh /startup.bat
關(guān)閉服務(wù)
# /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 系統(tǒng)整合
# vi /usr/local/apache/conf/httpd.conf
在文件最末尾加上如下語(yǔ)句
#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
添加下列語(yǔ)句
#
# 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行左右加入如下語(yǔ)句(去注釋)
若第二臺(tái)tomcat,將jvmRoute的修改為tomcat2
系統(tǒng)整合完畢
啟動(dòng)apache和tomcat服務(wù)
# /usr/local/apache/bin/apachectl start
# /usr/local/tomcat/bin/catalina.sh start
將如下內(nèi)容添加至/etc/rc.d/rc.local文件末尾
以便系統(tǒng)啟動(dòng)后開啟apache,tomcat服務(wù)
#vi /etc/rc.d/rc.local
添加
/usr/local/tomcat/bin/catalina.sh start
/usr/local/apache/bin/apachectl start
到此,相信大家對(duì)“Linux系統(tǒng)Jsp環(huán)境下Apache和Tomcat的配置”有了更深的了解,不妨來實(shí)際操作一番吧!這里是創(chuàng)新互聯(lián)建站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!
新聞標(biāo)題:Linux系統(tǒng)Jsp環(huán)境下Apache和Tomcat的配置-創(chuàng)新互聯(lián)
轉(zhuǎn)載來于:http://m.rwnh.cn/article32/djiisc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供域名注冊(cè)、品牌網(wǎng)站制作、微信小程序、軟件開發(fā)、移動(dòng)網(wǎng)站建設(shè)、營(yíng)銷型網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容