Tomcat的用法,

首先你要有一台自己的服务器
一,配置jdk,jre环境具体可参见以下教程
https://jingyan.baidu.com/article/6dad5075d1dc40a123e36ea3.html
二,下载安装tomcat
三,上传自己的网站代码,
四,修改tomcat默认主页—关键
1,默认的项目都在目录:apache-tomcat-9.0.0.M22\webapps\ROOT下
2、该目录下有一个index.jsp是tomcat的默认主页,一只小老虎
3,修改这个默认主页,改成自己的主页
(1)修改配置文件server.xml(在conf目录下),找到如下代码:<Host name="172.18.0.5" appBase="webapps" unpackWARs="true" autoDeploy="true"> <Context path="" docBase="C:\apache-tomcat-9.0.0.M22\webapps\ROOT"/>
修改第三行为<Context path="" docBase="C:\apache-tomcat-9.0.0.M22\webapps\ROOT\1" debug="0"/>
其中C:\apache-tomcat-9.0.0.M22\webapps\ROOT\1就是你想设置的网站根目录,我这里的根目录就是1
(2)修改配置文件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>

在第一行添加上指定文件,如work_detail.html,注意:work_detail.html是目录1下的文件

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

还可以配置端口号,默认是8080,我这里改的是3000
D:\Tomcat 9.0\conf\server.xml
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值