配置环境:win2003+iis6+apache2+tomcat6+mysql5
配置要求:所有web应用外部都能够通过80访问,即共享80端口
配置方案:iis跑asp,aspx,php应用,tomcat跑jsp应用,apache做代理。
配置步骤:
1.安装iis设置监听端口为8081,apache为80,tomcat为8080,mysql默认安装
2.配置apache代理
修改conf/httpd.conf文件,启用proxy_module和proxy_http_module,修改的内容是:
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
然后在conf/httpd.conf文件中增加如下几行:
ProxyPass /php ! (我本机用iis解析php,这行注释掉)
ProxyPass /asp/ http://localhost:8081/
ProxyPassReverse /asp/ http://localhost:8081/
ProxyPass /jsp/ http://localhost:8080/
ProxyPassReverse /jsp/ http://localhost:8080/
3.apache虚拟主机配置
修改conf/httpd.conf文件,修改的内容是:
Include conf/extra/httpd-vhosts.conf
<Directory>中设置各个服务所在网站的目录权限,例如我的是:
<Directory "D:/Tomcat/webapps">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
<Directory "E:/htdocs">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
修改虚拟主机配置文件,conf/extra/httpd-vhosts.conf,增加如下标签:
<VirtualHost *:80>
ServerAdmin test@test.com.
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/
ServerName jsp.com">www.jsp.com
</VirtualHost>
<VirtualHost *:80>
ServerAdmin test@test.com.
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:8081/
ProxyPassReverse / http://127.0.0.1:8081/
ServerName asp.com">www.asp.com
</VirtualHost>
4.tomcat虚拟主机配置
修改conf/server.xml,增加如下标签:
<Host name="www.jsp.com" debug="0" appBase="e:\htdocsmain" unpackWARs="true" autoDeploy="true">
<Context path="" docBase="."/>
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="www_jsp_com_access_log."
suffix=".txt" pattern="common" resolveHosts="false"/>
<Logger className="org.apache.catalina.logger.FileLogger" directory="logs" prefix="www_jsp_com_log." suffix=".txt" timestamp="true"/>
配置一个域名为www.jsp.com的虚拟主机,设置其根目录为:e:\htdocsmain
5.iis虚拟主机设置
这里配置iis解析php就不多说了,网上资料很完整。
新建一个网站,主机头设置为www.asp.com,根目录e:htdocsasp
启动所有服务
访问:
http://www.jsp.com
http://www.jsp.com:8080
http://www.asp.com
http://www.asp.com:8081
配置成功!