日期:2014-05-16  浏览次数:21182 次

apache+tomcate整合多域名绑定ip地址

上一篇文章已经讲了apache+tomcate整合和单域名绑定

?

现在来说一下多于名绑定,刚刚测试成功。

?

首先要说的是进入apache文件夹中conf中httpd.conf文件或者conf中extra文件中的httpd-vhosts.conf文件

?

这两个只需要配置一个就可以了,httpd.conf中没有下面的代码,添加进去就可以了,httpd-vhosts.conf只需要修改即可。

?

?

第一个域名www.jack


NameVirtualHost *:80

<VirtualHost *:80>
ServerName
www.jack
DocumentRoot "C:/Program Files/Apache Software Foundation/Tomcat 5.5/webapps/Storage"
?DirectoryIndex login.jsp
???????
<Directory "C:/Program Files/Apache Software Foundation/Tomcat 5.5/webapps/Storage">
? Options -Indexes FollowSymLinks
? AllowOverride None
? Order allow,deny
? Allow from all
</Directory>

</VirtualHost>

?

?

?

第二个域名www.wangwei

<VirtualHost *:80>
ServerName
www.wangwei
DocumentRoot "C:/Program Files/Apache Software Foundation/Tomcat 5.5/webapps/Storage"
?DirectoryIndex login.jsp
???????
<Directory "C:/Program Files/Apache Software Foundation/Tomcat 5.5/webapps/Storage">
? Options -Indexes FollowSymLinks
? AllowOverride None
? Order allow,deny
? Allow from all
</Directory>

</VirtualHost>

?

?

默认的本地
<VirtualHost *:80>
ServerName localhost
DocumentRoot "C:/Program Files/Apache Software Foundation/Tomcat 5.5/webapps/Storage"
?DirectoryIndex login.jsp
???????
<Directory "C:/Program Files/Apache Software Foundation/Tomcat 5.5/webapps/Storage">
? Options -Indexes FollowSymLinks
? AllowOverride None
? Order allow,deny
? Allow from all
</Directory>

</VirtualHost>

?

?

接下来配置tomcate中conf文件夹中的server.xml文件

这是?默认的,但是我们也修改了,如果用ip访问 这个就是本机默认的项目。

?<Host name="localhost" appBase="co"
?????? unpackWARs="true" autoDeploy="true"
?????? xmlValidation="false" xmlNamespaceAware="false">
???????????? <Context path="" docBase="C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\Storage" debug="0" reloadable="true"/>
?</Host>

?

?

第一个域名

?<Host name="www.jack" debug="0" appBase="co1" unpackWARs="true" autoDeploy="true">
????????? <alias>www.jack</alias>
???????? <Context path="" docBase="C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\Storage" debug="0" reloadable="true"/>
?? </Host>

?

?

第二个域名

?<Host name="www.wangwei" debug="0" appBase="co2" unpackWARs="true" autoDeploy="true">
????????? <alias>www.wangwei</alias>
???????? <Context path="" docBase="C:\Pro