tomcat 绑定域名

1.到apache-tomcat-6.0.30\conf\server.xml 把8080端口改为80

2.更改虚拟域名

<Host name="two.localhost" debug="0" appBase="D:\page"

       unpackWARs="true" autoDeploy="true"

       xmlValidation="false" xmlNamespaceAware="false">

       <Alias>two.localhost.com</Alias> 

       <Logger className="org.apache.catalina.logger.FileLogger"

                 directory="logs" prefix="localhost_log." suffix=".txt"

            timestamp="true"/>

        <Context path="/" docBase="D:\page" reloadable="true" caseSensitive="false" debug="0"></Context>

3.到C:\Windows\System32\drivers\etc\hosts把 localhost name resolution is handled within DNS itself.

# 127.0.0.1       localhost

202.106.0.20       two.localhost

# 127.0.0.1       two.localhost.com

127.0.0.1       cheng

# ::1             localhost改了。前面的井号是注视,要把注视去掉

 

<script language="javascript">

location.href="http://two.localhost/K-PTMS";

</script>

 

我是在d盘下有一个web文件夹---下边有root和k-ptms root文件有html html里就是指定的项目

你可能感兴趣的:(tomcat)