1)开通泛域名支持,即java.book.cn,net.book.cn,www.books.cn都指向同一IP,如127.0.0.1
(2)修改tomcat目录下的conf/server.xml,在engine里面添加
<Host name="localhost" debug="0" appBase=""
unpackWARs="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.0\\webapps\\book"
reloadable="true" caseSensitive="false" debug="0"></Context>
</Host>
<Host name="java.book.cn" debug="0" appBase=""
unpackWARs="true"
xmlValidation="false" xmlNamespaceAware="false">
<Alias>java.book.cn</Alias>
<Context path="" docBase="E:\\Tomcat5.0\\webapps\\java"
reloadable="true" caseSensitive="false" debug="0"></Context>
</Host>
<Host name="net.book.cn" debug="0" appBase=""
unpackWARs="true"
xmlValidation="false" xmlNamespaceAware="false">
<Alias>net.book.cn</Alias>
<Context path="" docBase="E:\\Tomcat5.0\\webapps\\net"
reloadable="true" caseSensitive="false" debug="0"></Context>
</Host>
<Host name="www.books.cn" debug="0" appBase=""
unpackWARs="true"
xmlValidation="false" xmlNamespaceAware="false">
<Alias>www.books.cn</Alias>
<Context path="" docBase="E:\\Tomcat5.0\\webapps\\books"
reloadable="true" caseSensitive="false" debug="0"></Context>
</Host>