一、下载安装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 keken@163.com
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 --查看启动信息