我们都知道spring boot是内置了tomcat服务器,下面就是 如何在配置文件里配置启动时Tomcat的基本配置:
- spring boot默认端口号是8080,如果要修改端口的话,只需要修改application.properties文件,在其中加入
server.port=9084
- 整个项目的根路径配置
server.servlet.context-path=/demo
- 其他选项配置如下
(1)#server.port=8080
(2)server.address= # bind to a specific NIC
(3)server.session-timeout= # session timeout in seconds the context path, defaults to ‘/’
(4)server.tomcat.access-log-pattern= # log pattern of the access log
(5)server.tomcat.access-log-enabled=false # is access logging enabled
(6)server.tomcat.protocol-header=x-forwarded-proto # ssl forward headers
(7)server.tomcat.remote-ip-header=x-forwarded-for
(8)server.tomcat.basedir=/tmp # base dir (usually not needed, defaults to tmp)
(9)server.tomcat.background-processor-delay=30; # in seconds
(10)server.tomcat.max-threads = 0 # number of threads in protocol handler
(11)server.tomcat.uri-encoding = UTF-8 # character encoding to use for URL decoding
(12)server.tomcat.accept-count=128 #tomcat Send-Q number default 100
(13)server.connection-timeout=30 #Time that connectors wait for another HTTP request before closing the connection