直接输入ip地址则进入项目的某个页面方法

来源:互联网 发布:逆袭网络剧第六集美拍 编辑:程序博客网 时间:2024/05/16 05:54

修改Tomcat配置文件:

1.web.xml文件
将<welcome-file>index.jsp</welcome-file>放在最前面:
效果:
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
        
</welcome-file-list>
2.server.xml文件
在<Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">
   与</Host>之间加上:<Context path="" docBase="website" reloadable="true" crossContext="true" ></Context>
加完之后的效果:
<Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">


        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->


        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"  
               prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
        -->
<Context path="" docBase="website" reloadable="true" crossContext="true" ></Context>
</Host>
3.server.xml文件
端口号改成80
方法:
<Connector port="80" protocol="HTTP/1.1" 
               connectionTimeout="20000" 
               redirectPort="8443" />