adj 2007-11-2 14:53
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: [url]http://java.sun.com/j2se/1.4.2/download.html[/url]
(2)xampp-linux-1.5.0.tar.gz
Download: [url]http://sourceforge.net/project/showfiles.php?group_id=61776&package_id=60248[/url]
直接下載: [url]http://downloads.sourceforge.net/xampp/xampp-linux-1.5.0.tar.gz?modtime=1130784873&big_mirror=1[/url]
(3)xampp_tomcat-5.0.27-addon-0.3.tar.gz
Download頁面: [url]http://addons.xampp.org/cgi-bin/search.pl?pid=9[/url]
直接下載: [url]http://apf.kwm-web.info/downloads/dilu/xampp_tomcat-5.0.27-addon-0.3.tar.gz[/url]
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:
[url]http://your.domain:8080/[/url]
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 [url]www.mno.com.tw[/url]
<Location "/*.jsp">
JkUriSet worker ajp13:localhost:8009
</Location>
</VirtualHost>
(1)設定連接檔案→ vi /opt/lampp/conf/workers2.properties
[url:[url]www.mno.com.tw/[/url]*.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
[url]http://www.cosa.org.tw/cosa_act/tm/tomcat/[/url]
[url]http://java.sun.com[/url]
[url]http://tomcat.apache.org/connectors-doc/[/url]
[url]http://phorum.study-area.org/viewtopic.php?t=34986[/url]
[url]http://www.javaworld.com.tw/jute/post/view?bid=9&id=138351&sty=3[/url]