文章导读:在新的一年中,各位网友都进入紧张的学习或是工作阶段。网学的各位小编整理了JAVA-tomcat单IP 多个二级域名配置方法网摘的相关内容供大家参考,祝大家在新的一年里工作和学习顺利!
(1)开通泛域名支持,即house.map512.cn,plan.map512.cn,map512.cn都指向同一IP,如218.4.157.245
(2)修改tomcat目录下的conf/server.xml,在engine里面添加 <Host name="localhost" debug="0" appBase="E:Tomcat5.0webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false"> <Logger className="org.apache.catalina.logger.FileLogger" directory="logs" prefix="localhost_log." suffix=".txt" timestamp="true"/> <Context path="" docBase="E:Tomcat5.0webappsszmap" reloadable="true" caseSensitive="false" debug="0"></Context> </Host> <Host name="house.map512.cn" debug="0" appBase="E:Tomcat5.0suzhou" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false"> <Alias>house.map512.cn</Alias> <Context path="" docBase="E:Tomcat5.0suzhouszhouse" reloadable="true" caseSensitive="false" debug="0"></Context> </Host> <Host name="plan.map512.cn" debug="0" appBase="E:Tomcat5.0suzhou" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false"> <Alias>plan.map512.cn</Alias> <Context path="" docBase="E:Tomcat5.0suzhouszghgs" reloadable="true" caseSensitive="false" debug="0"></Context> </Host> <IfModule rewrite_module> RewriteEngine on rewritecond %{HTTP_HOST} ^([^.]+).54ttc.com$ rewriterule ^(.+) %{HTTP_HOST}$1 [C] Rewriterule ^([^.]+).54ttc.com(.*) http://54ttc.com/index.jsp?username=$1 </IfModule>我要把人家输入的XXX.54ttc.com中的XXX传到index.jsp这个页面中,上面的格式有错吗再一个就是XXX.54ttc.com访问的时候,跳到TOMCAT的默认页面去了,而不是跳到www.54ttc.com的首页,请问高手如何配和如何设置啊 在网上找了半天也没找到相关的资料,都说的太含糊.本人对tomcat下配置 一ip对多域名的方法详细如下,按下面配置一定能成功,经过测试了. <Host name="localhost" debug="0" appBase="D:Tomcat 5.0webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false"> <Alias>localhost.com</Alias> <Logger className="org.apache.catalina.logger.FileLogger" directory="logs" prefix="localhost_log." suffix=".txt"