1、更改默认端口号:
Tomcat默认端口号为8080,如果想更改成其他端口,比如80,可以找到tomcat的server.xml(在conf目录下)
1
|
<
Connector
port
=
"8080"
protocol
=
"HTTP/1.1"
connectionTimeout
=
"20000"
redirectPort
=
"8443"
/>
|
把8080改为80即可。
2、更改默认根目录:
Tomcat默认根目录为ROOT目录,如果想更改到其他目录,比如/webapps/Test/,可以找到tomcat的server.xml(在conf目录下)
1
2
3
|
<
Host
name
=
"localhost"
appBase
=
"webapps"
unpackWARs
=
"true"
autoDeploy
=
"true"
>
</
Host
>
|
在</Host>前插入:
1
|
<
Context
path
=
""
docBase
=
"你要设置的目录"
debug
=
"0"
/>
|
3、更改默认首页:
Tomcat的默认首页在web.xml(在conf目录下)中找到
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
>
|
这是tomcat默认的3个文件,当你输入指定路径后,tomcat会自动查找这3个页面。如果你想让tomcat自动找到自己的页面,比如main.jsp。可以修改上面信息为:
1
2
3
4
5
6
|
<
welcome-file-list
>
<
welcome-file
>main.jsp</
welcome-file
>
<
welcome-file
>index.html</
welcome-file
>
<
welcome-file
>index.htm</
welcome-file
>
<
welcome-file
>index.jsp</
welcome-file
>
</
welcome-file-list
>
|
PS:当然以上所有操作完成后别忘了重启tomcat哦