apache和tomcat整合
需要的軟件包:httpd-2.2.21.tar.gz tomcat-connectors-1.2.32-src.tar.gz jdk-7-linux-x64.rpm apache-tomcat-7.0.23.tar.gz
首先安裝gcc做編譯前的環境。。
www.2cto.com
首先rpm -ivh jdk-7-linux-x64.rpm 安裝完成以後 創建一個連接 ln -s /usr/java/jdk1.7.0/ /usr/jdk
編譯apache
tar zxvf httpd-2.2.21.tar.gz -C /usr/local/src/
cd /usr/local/src/httpd-2.2.21/
./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite --enable-proxy --enable-proxy-ajp
make && make install
編譯tomcat-connectors-1.2.32-src.tar.gz
tar zxvf tomcat-connectors-1.2.32-src.tar.gz -C /usr/local/src/
cd /usr/local/src/tomcat-connectors-1.2.32-src/
cd native/
./configure --with-apxs=/usr/local/apache2/bin/apxs
make && make install
解壓apache-tomcat-7.0.23.tar.gz
tar zxvf apache-tomcat-7.0.23.tar.gz -C /usr/local/src/
cd /usr/local/src/apache-tomcat-7.0.23/
vim -o startup.sh shutdown.sh
在啟動和關閉文件分別添加:export JAVA_HOME=/usr/jdk
然後到tomcat的webapss裡面創建一個文件夾叫jsp
cd到jsp裡面
vim index.jsp
打開添加 <%=new java.util.Date() %>
修改tomcat配置文件
vim /usr/local/src/apache-tomcat-7.0.23/conf/server.xml
修改以下內容
cd /usr/local/apache2/htdocs
mkdir www
echo "111111111111111" > index.html
cd /usr/local/apache2/conf
vim httpd.conf
修改Directoryindex index.jsp index.html
添加
include conf/extra/httpd-vhost.conf
include conf/extra/httpd-jk.conf
cd extra
vim httpd-vhost.conf
vim httpd-jk.conf
vim workers.properties
重新啟動apache tomcat
測試: