一、下載安裝Apache2.2
1、下載Apache2.2 官方下載地址:http://apache.org/dyn/closer.cgi
2、[root@ ~]# tar –zxvf httpd-2.2.11.tar.gz
--解壓Apache
3、[root@ ~]# ./configure --enable-so --enable-module=proxy --enable-module=proxy-http --enable-rewrite=shared
--編譯
(./configure --prefix=/usr/local/apache --enable-so --enable-ssl=shared --enable-proxy=shared --enable-proxy-ajp=shared --enable-proxy-balancer=shared --enable-proxy-http=shared --enable-rewrite=shared --enable-mods-shared=all) --最後是加載所有模塊
4、[root@ ~]# make & make install
--安裝
二、下載安裝Tomcat6.0
1、下載Tomcat6.0 下載地址:http://tomcat.apache.org/
2、[root@ ~]# tar -zxvf apache-tomcat-6.0.16.tar.gz
--解壓tomcat
三、配置Tomcat6.0
1、[root@ ~]# vi /usr/local/Tomcat6.0/conf/server.xml
--打開配置文件
<Server port="8005" shutdown="SHUTDOWN"> --修改關閉Tomcat端口,此端口唯一
<Context path="" docBase="/usr/local/Tomcat6.0/webapps/xiangmu1" debug="0" reloadable="true" /> --添加指定項目路徑
<Connector port="8011" protocol="AJP/1.3" redirectPort="8443" URIEncoding="utf-8" /> --指定項目端口,此端口唯一
<!-- --註釋掉原本8080端口
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" /> -->
2、[root@ ~]# vi /usr/local/Tomcat6.0/conf/web.xml
--修改web.xml配置
<welcome-file-list> --修改首頁
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
四、配置啓動Apache
1、[root@ ~]# vi /usr/local/apache2/conf/httpd.conf
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so --加載模塊
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
2、[root@ ~]# vi /usr/local/apache/conf/extra/httpd-vhosts.conf
--配置vhost
<VirtualHost *:80>
ServerAdmin [email protected]
ProxyPass / ajp://192.168.1.100:8011/
ProxyPassReverse / ajp://192.168.1.100:8011/
ServerName www.abc.com
ErrorLog "logs/fzforum-error_log"
CustomLog "logs/fzforum-access_log" common
</VirtualHost>
3、[root@ ~]# /usr/local/apache/bin/httpd -k start
--啓動Apache
4、[root@ ~]# ln -s /usr/local/tomcat16testadmin/logs/catalina.out nohup
--建立軟連接,便於查看Tomcat日誌
5、[root@ ~]# tail -f nohup
--查看啓動信息