tomcat下普通网址配置

本文详细介绍了如何在Tomcat服务器的server.xml文件中修改8080端口为80,并调整默认根目录,包括添加和修改相关配置项。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

更改8080端口访问

在conf文件夹下的server.xml文件中修改

找到 8080 端口位置,修改为80

<Connector port="80" protocol="HTTP/1.1"


更改默认根目录

在conf文件夹下的server.xml文件中增加红色内容


<Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">


        <!-- 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
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log." suffix=".txt"
               pattern="%h %l %u %t &quot;%r&quot; %s %b" />
        <Context path="" docBase="D:/tomcat/webapps/sacshop/" debug="0"/>
      </Host>

同时在web.xml中检查

<welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

如果没有你需要的入口文件,自行照样设置。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值