前言
Tomcat配置Web应用缺省值
配置容器的默认Web应用
- 在
webapp
目录下创建一个目录ROOT
,这个目录就是默认的Web应用
配置Web应用的默认主页
- 修改配置文件
- 如果配置文件没有配置
<welcome-file-list></welcome-file-list>
,那么会参考全局配置
- 可以配置多条
<welcome-file></welcome-file>
,当第一条失效时,自动使用第二条的配置
index.html
:首页路径
WEB-INF/web.xml
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="https://jakarta.ee/xml/ns/jakartaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd" version="5.0" metadata-complete="true">
<welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> </welcome-file-list>
</web-app>
|
全局配置中的默认主页配置
/opt/homebrew/etc/tomcat/web.xml
1 2 3 4 5
| <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> </welcome-file-list>
|
完成