1. 首先把项目的wa 包丢在tomcat 的应用目录
[root@MFS-chunkserver-2 ~]# cd /usr/local/tomcat/webapps/
[root@MFS-chunkserver-2 webapps]# ls
aaa.war balancer bbb.war jsp-examples ROOT servlets-examples
tomcat-docs webdav
2. 编辑apache 的配置文件
(1) 首先加载模块
[root@MFS-chunkserver-2 webapps]# cd /etc/httpd/conf/
[root@MFS-chunkserver-2 webapps]# vi httpd.conf(添加如下内容到配置文件
的末尾)
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
include /etc/httpd/conf/sites-enabled/
NameVirtualHost *:80
(2) 创建相关目录
[root@MFS-chunkserver-2 httpd]# cd /etc/httpd/conf
[root@MFS-chunkserver-2 conf]# mkdri sites-available/
[root@MFS-chunkserver-2 conf]# mkdri sites-enabled/
(3) 创建虚拟主机配置文件
[root@MFS-chunkserver-2 conf]# cd sites-available/
[root@MFS-chunkserver-2 sites-available]# vi qubaoquan.com.vhost(内容如
下)
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.qubaoquan.com
ProxyPass / http://192.168.10.118:8080/ispace1/
ProxyPassReverse / http://192.168.10.118:8080/ispace1/
</VirtualHost>
[root@MFS-chunkserver-2 sites-available]# vi test.com.vhost(内容如下)
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.test.com
ProxyPass / http://192.168.10.118:8080/ispace2/
ProxyPassReverse / http://192.168.10.118:8080/ispace2/
</VirtualHost>
(4) 链接文件
[root@MFS-chunkserver-2 sites-available]# cd ../sites-enabled/
#ln -sf ./test.com.vhost ../sites-enabled/test.com.vhost
#ln -s ../sites-enabled/qubaoquan.com.vhost .
3. 重新加载服务
[root@MFS-chunkserver-2 sites-enabled]# kill -HUP `cat /var/run/httpd.pid `