1. 程式人生 > >springboot 專案啟動配置tomcat引數 詳解

springboot 專案啟動配置tomcat引數 詳解

我們都知道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