ADJ網路實驗室
打印

CentOS 4.4上利用xampp整合Apache和Tomcat

CentOS 4.4上利用xampp整合Apache和Tomcat

xampp可以將 Apache+php+mysql+phpmyadmin一次性自動安裝完成,很適合快速搭建測試服務器.它也提供了tomcat的插件,可以

很快的搭建jsp開發環境.就成了 Apache+php+mysql+phpmyadmin+Tomcat+Jsp開發環境


Prepare:
(1)j2sdk-1_4_2_13-linux-i586-rpm.bin
Download: http://java.sun.com/j2se/1.4.2/download.html

(2)xampp-linux-1.5.0.tar.gz
Download: http://sourceforge.net/project/s ... mp;package_id=60248
直接下載: http://downloads.sourceforge.net ... 73&big_mirror=1

(3)xampp_tomcat-5.0.27-addon-0.3.tar.gz
Download頁面: http://addons.xampp.org/cgi-bin/search.pl?pid=9
直接下載: http://apf.kwm-web.info/download ... 27-addon-0.3.tar.gz


Install:
# chmod +x j2sdk-1_4_2_13-linux-i586-rpm.bin
# ./j2sdk-1_4_2_13-linux-i586-rpm.bin
# rpm -Uvh j2sdk-1_4_2_13-linux-i586.rpm

# tar zxvf xampp-linux-1.5.0.tar.gz -C /opt
# tar zxvf xampp_tomcat-5.0.27-addon-0.3.tar.gz -C /opt

# cd /opt/lampp
# ln -s /usr/java/j2sdk1.4.2_13 /opt/lampp/java


Add the following line to "httpd.conf":
   Include etc/tomcat.conf

Edit "workers2.properties" in "/opt/lampp/conf", search for the following
   line and put in your real internet domain:
   [uri:your.domain/*.jsp]

Start XAMPP:
# /opt/lampp/lampp start

Test the Tomcat installation by accessing the following URL:
http://your.domain:8080/

If everything went ok, you should see the default local Tomcat homepage.
To administrate or manage Tomcat you can use a predefined administrative
account:

username: xampp
password: xampp


======================  設定虛擬主機  ========================

NameVirtualHost *:80

.......

<VirtualHost *:80>
DocumentRoot /opt/lampp/webapps/mno/
ServerName www.mno.com.tw
<Location "/*.jsp">
JkUriSet worker ajp13:localhost:8009
</Location>
</VirtualHost>

(1)設定連接檔案→ vi /opt/lampp/conf/workers2.properties

[url:www.mno.com.tw/*.jsp]
worker=ajp13:localhost:8009

(2)建立網頁存放的目錄

(3)設定tomcat→ vi /tomcat/conf/server.xml

在<!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8080 -->下面把
<Connector port="8080" maxThreads="150".....區塊給註解起來
使用 <!-- 頭與尾 --> 註解

在<!-- Define the default virtual host -->和
<Host name="localhost" debug="0" appBase="webapps"中間加入

<Host name="www.mno.com.tw" debug="0" appBase="/opt/lampp/webapps/mno"
unpackWARs="true" autoDeploy="true">
<Context path="" docBase="" debug="1"/>
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs" prefix="cust1_access_log." suffix=".txt" pattern="common"
resolvHosts="false" />
</Host>

(4)設定DNS

(5)重新啟動 /opt/lampp/lampp restart



Reference materials:
Package DL
http://www.cosa.org.tw/cosa_act/tm/tomcat/
http://java.sun.com
http://tomcat.apache.org/connectors-doc/
http://phorum.study-area.org/viewtopic.php?t=34986
http://www.javaworld.com.tw/jute ... id=138351&sty=3





TOP

ARTERY.cn