Tomcat8.0 Connector参数

Tomcat8.0 Connector参数

All implementations of Connector support the following attributes:
AttributeDescription描述
allowTraceA boolean value which can be used to enable or disable the TRACE HTTP method. If not specified, this attribute is set to false是否禁用http trace方法,默认值fales
asyncTimeoutThe default timeout for asynchronous requests in milliseconds. If not specified, this attribute is set to the Servlet specification default of 30000 (30 seconds)异步请求的默认超时时间(以毫秒为单位)。 如果未指定,则此属性设置为默认值为30000(30秒)
enableLookupsSet to true if you want calls to request.getRemoteHost() to perform DNS lookups in order to return the actual host name of the remote client. Set to false to skip the DNS lookup and return the IP address in String form instead (thereby improving performance). By default, DNS lookups are disabled.如果要调用request.getRemoteHost()执行DNS查找以返回远程客户端的实际主机名,请设置为true。 设置为false则跳过DNS查找,并以String形式返回IP地址(从而提高性能)。 默认情况下,DNS查找被禁用。
maxHeaderCountThe maximum number of headers in a request that are allowed by the container. A request that contains more headers than the specified limit will be rejected. A value of less than 0 means no limit. If not specified, a default of 100 is used.容器允许的请求中的最大header数。 包含比指定限制更多的header的请求将被拒绝。 小于0表示无限制,默认值100。
maxParameterCountThe maximum size in bytes of the POST which will be handled by the container FORM URL parameter parsing. The limit can be disabled by setting this attribute to a value less than zero. If not specified, this attribute is set to 2097152 (2 megabytes). Note that the FailedRequestFilter can be used to reject requests that exceed this limit.POST的最大值(以字节为单位),将由容器FORM URL参数解析来处理。若小于0则不限制,默认为2097152(2MB)。 请注意,FailedRequestFilter可用于拒绝超出此限制的请求。
maxPostSizeThe maximum size in bytes of the POST which will be saved/buffered by the container during FORM or CLIENT-CERT authentication. For both types of authentication, the POST will be saved/buffered before the user is authenticated. For CLIENT-CERT authentication, the POST is buffered for the duration of the SSL handshake and the buffer emptied when the request is processed. For FORM authentication the POST is saved whilst the user is re-directed to the login form and is retained until the user successfully authenticates or the session associated with the authentication request expires. The limit can be disabled by setting this attribute to -1. Setting the attribute to zero will disable the saving of POST data during authentication. If not specified, this attribute is set to 4096 (4 kilobytes)在FORM或CLIENT-CERT身份验证期间,将由容器保存/缓冲的POST的最大大小(以字节为单位)。 对于这两种类型的身份验证,POST将在用户进行身份验证之前进行保存/缓冲。 对于CLIENT-CERT认证,POST在SSL握手期间进行缓冲,缓冲区在处理请求时清空。 对于FORM身份验证,POST将被保存,同时用户被重定向到登录表单,并保留,直到用户成功认证或与身份验证请求相关联的会话过期。 可以通过将此属性设置为-1来禁用该限制。 将属性设置为零将在身份验证期间禁用POST数据的保存。 如果未指定,此属性设置为4096(4kb)
parseBodyMethodsA comma-separated list of HTTP methods for which request bodies will be parsed for request parameters identically to POST. This is useful in RESTful applications that want to support POST-style semantics for PUT requests. Note that any setting other than POST causes Tomcat to behave in a way that goes against the intent of the servlet specification. The HTTP method TRACE is specifically forbidden here in accordance with the HTTP specification.The default is POST 以逗号分隔的HTTP方法列表,请求主体将被解析为与POST相同的请求参数。 这对于希望支持PUT请求的POST样式语义的RESTful应用程序很有用。 请注意,POST之外的任何设置都会导致Tomcat的行为违反了servlet规范。 这里根据HTTP规范特别禁止HTTP方法TRACE。 默认为POST
portThe TCP port number on which this Connector will create a server socket and await incoming connections. Your operating system will allow only one server application to listen to a particular port number on a particular IP address. If the special value of 0 (zero) is used, then Tomcat will select a free port at random to use for this connector. This is typically only useful in embedded and testing applications.您的操作系统将只允许一个服务器应用程序侦听特定IP地址上的特定端口号。 如果使用特殊值0,则Tomcat将随机选择一个空闲端口用于此连接器。
protocolSets the protocol to handle incoming traffic. The default value is HTTP/1.1 which uses an auto-switching mechanism to select either a non blocking Java NIO based connector or an APR/native based connector. If the PATH (Windows) or LD_LIBRARY_PATH (on most unix systems) environment variables contain the Tomcat native library, the APR/native connector will be used. If the native library cannot be found, the non blocking Java based connector will be used. Note that the APR/native connector has different settings for HTTPS than the Java connectors.To use an explicit protocol rather than rely on the auto-switching mechanism described above, the following values may be used:org.apache.coyote.http11.Http11Protocol - blocking Java connectororg.apache.coyote.http11.Http11NioProtocol - non blocking Java NIO connectororg.apache.coyote.http11.Http11Nio2Protocol - non blocking Java NIO2 connectororg.apache.coyote.http11.Http11AprProtocol - the APR/native connector.Custom implementations may also be used.Take a look at our Connector Comparison chart. The configuration for both Java connectors is identical, for http and https.For more information on the APR connector and APR specific SSL settings please visit the APR documentation
proxyNameIf this Connector is being used in a proxy configuration, configure this attribute to specify the server name to be returned for calls to request.getServerName(). See Proxy Support for more information.
proxyPortIf this Connector is being used in a proxy configuration, configure this attribute to specify the server port to be returned for calls to request.getServerPort(). See Proxy Support for more information.
redirectPortIf this Connector is supporting non-SSL requests, and a request is received for which a matching requires SSL transport, Catalina will automatically redirect the request to the port number specified here.
schemeSet this attribute to the name of the protocol you wish to have returned by calls to request.getScheme(). For example, you would set this attribute to “https” for an SSL Connector. The default value is “http”.
secureSet this attribute to true if you wish to have calls to request.isSecure() to return true for requests received by this Connector. You would want this on an SSL Connector or a non SSL connector that is receiving data from a SSL accelerator, like a crypto card, a SSL appliance or even a webserver. The default value is false.
URIEncodingThis specifies the character encoding used to decode the URI bytes, after %xx decoding the URL. If not specified, UTF-8 will be used unless the org.apache.catalina.STRICT_SERVLET_COMPLIANCE system property is set to true in which case ISO-8859-1 will be used.
useBodyEncodingForURIThis specifies if the encoding specified in contentType should be used for URI query parameters, instead of using the URIEncoding. This setting is present for compatibility with Tomcat 4.1.x, where the encoding specified in the contentType, or explicitly set using Request.setCharacterEncoding method was also used for the parameters from the URL. The default value is false.Notes: 1) This setting is applied only to the query string of a request. Unlike URIEncoding it does not affect the path portion of a request URI. 2) If request character encoding is not known (is not provided by a browser and is not set by SetCharacterEncodingFilter or a similar filter using Request.setCharacterEncoding method), the default encoding is always “ISO-8859-1”. The URIEncoding setting has no effect on this default.
useIPVHostsSet this attribute to true to cause Tomcat to use the IP address that the request was received on to determine the Host to send the request to. The default value is false
xpoweredBySet this attribute to true to cause Tomcat to advertise support for the Servlet specification using the header recommended in the specification. The default value is false.
The standard HTTP connectors (BIO, NIO, NIO2 and APR/native) all support the following attributes in addition to the common Connector attributes listed above.
AttributeDescription描述
acceptCountThe maximum queue length for incoming connection requests when all possible request processing threads are in use. Any requests received when the queue is full will be refused. The default value is 100.所有可能的请求处理线程正在使用时,传入连接请求的最大队列长度。 当队列满时收到的任何请求都将被拒绝。 默认值为100。
acceptorThreadCountThe number of threads to be used to accept connections. Increase this value on a multi CPU machine, although you would never really need more than 2. Also, with a lot of non keep alive connections, you might want to increase this value as well. Default value is 1.用于接受连接的线程数。 在多CPU机器上增加此值,尽管您绝对不会需要超过2.另外,通过大量的非保持活动连接,您也可以增加此值。 默认值为1。
connectionTimeoutThe number of milliseconds this Connector will wait, after accepting a connection, for the request URI line to be presented. Use a value of -1 to indicate no (i.e. infinite) timeout. The default value is 60000 (i.e. 60 seconds) but note that the standard server.xml that ships with Tomcat sets this to 20000 (i.e. 20 seconds). Unless disableUploadTimeout is set to false, this timeout will also be used when reading the request body (if any).连接器在接受连接后等待的请求URI行的毫秒数。 使用值-1表示无(即无穷大)超时。 默认值为60000(即60秒),但请注意Tomcat附带的标准server.xml将其设置为20000(即20秒)。 除非disableUploadTimeout设置为false,否则读取请求主体(如果有的话)也将使用此超时。
keepAliveTimeoutThe number of milliseconds this Connector will wait for another HTTP request before closing the connection. The default value is to use the value that has been set for the connectionTimeout attribute. Use a value of -1 to indicate no (i.e. infinite) timeout.连接器在关闭连接之前等待另一个HTTP请求的毫秒数。 默认值是使用为connectionTimeout属性设置的值。 使用值-1表示无(即无穷大)超时。
maxConnectionsThe maximum number of connections that the server will accept and process at any given time. When this number has been reached, the server will accept, but not process, one further connection. This additional connection be blocked until the number of connections being processed falls below maxConnections at which point the server will start accepting and processing new connections again. Note that once the limit has been reached, the operating system may still accept connections based on the acceptCount setting. The default value varies by connector type. For BIO the default is the value of maxThreads unless an Executor is used in which case the default will be the value of maxThreads from the executor. For NIO and NIO2 the default is 10000. For APR/native, the default is 8192.Note that for APR/native on Windows, the configured value will be reduced to the highest multiple of 1024 that is less than or equal to maxConnections. This is done for performance reasons.If set to a value of -1, the maxConnections feature is disabled and connections are not counted.服务器在任何给定时间接受和处理的最大连接数。当达到这个数字时,服务器将接受一个进一步的连接,但不会处理。这个附加连接将被阻塞,直到正在处理的连接数降到maxConnections以下,服务器再次开始接受并重新处理新的连接。请注意,一旦达到限制,操作系统仍然可以接受基于acceptCount设置的连接。默认值因连接器类型而异。对于BIO,默认值是maxThreads的值,除非使用Executor,在这种情况下,默认值将是执行器的maxThreads值。对于NIO和NIO2,默认值为10000.对于APR / native,默认值为8192。请注意,对于Windows上的APR / native,配置的值将减少到小于或等于maxConnections的1024的最高倍数。这是出于性能原因。如果设置为-1,则禁用maxConnections功能,并且不计算连接。maxKeepAliveRequests The maximum number of HTTP requests which can be pipelined until the connection is closed by the server. Setting this attribute to 1 will disable HTTP/1.0 keep-alive, as well as HTTP/1.1 keep-alive and pipelining. Setting this to -1 will allow an unlimited amount of pipelined or keep-alive HTTP requests. If not specified, this attribute is set to 100. 在服务器关闭连接之前,可以流水线的最大HTTP请求数。 将此属性设置为1将禁用HTTP / 1.0保持活动,以及HTTP / 1.1保持活动和流水线。 将其设置为-1将允许无限量的流水线或保持活动的HTTP请求。 如果未指定,则此属性设置为100。
maxThreadsThe maximum number of request processing threads to be created by this Connector, which therefore determines the maximum number of simultaneous requests that can be handled. If not specified, this attribute is set to 200. If an executor is associated with this connector, this attribute is ignored as the connector will execute tasks using the executor rather than an internal thread pool. Note that if an executor is configured any value set for this attribute will be recorded correctly but it will be reported (e.g. via JMX) as -1 to make clear that it is not used.此连接器要创建的请求处理线程的最大数量,因此确定可以处理的最大并发请求数。 如果未指定,则此属性设置为200.如果执行程序与此连接器相关联,则此属性将被忽略,因为连接器将使用执行程序而不是内部线程池执行任务。 请注意,如果配置了执行程序,则为此属性设置的任何值都将被正确记录,但会将其(例如通过JMX)报告为-1,以表明它不被使用。
compressionThe Connector may use HTTP/1.1 GZIP compression in an attempt to save server bandwidth. The acceptable values for the parameter is “off” (disable compression), “on” (allow compression, which causes text data to be compressed), “force” (forces compression in all cases), or a numerical integer value (which is equivalent to “on”, but specifies the minimum amount of data before the output is compressed). If the content-length is not known and compression is set to “on” or more aggressive, the output will also be compressed. If not specified, this attribute is set to “off”.Note: There is a tradeoff between using compression (saving your bandwidth) and using the sendfile feature (saving your CPU cycles). If the connector supports the sendfile feature, e.g. the NIO connector, using sendfile will take precedence over compression. The symptoms will be that static files greater that 48 Kb will be sent uncompressed. You can turn off sendfile by setting useSendfile attribute of the connector, as documented below, or change the sendfile usage threshold in the configuration of the DefaultServlet in the default conf/web.xml or in the web.xml of your web application.连接器可以使用HTTP / 1.1 GZIP压缩来尝试保存服务器带宽。参数的可接受值为“关闭”(禁用压缩),“开”(允许压缩,导致文本数据压缩),“强制”(强制所有情况下的压缩)或数字整数值相当于“on”,但指定输出压缩前的最小数据量)。如果内容长度不知道,并且压缩设置为“开”或更积极,则输出也将被压缩。如果未指定,则此属性设置为“关闭”。注意:使用压缩(节省带宽)和使用sendfile功能(节省CPU周期)之间存在折衷。如果连接器支持发送文件功能,例如使用sendfile的NIO连接器将优先于压缩。症状将是静态文件大于48 Kb将被未压缩发送。您可以通过设置连接器的useSendfile属性来关闭sendfile,如下所述,或者在默认conf / web.xml或Web应用程序的web.xml中的DefaultServlet配置中更改发送文件使用阈值。
executorA reference to the name in an Executor element. If this attribute is set, and the named executor exists, the connector will use the executor, and all the other thread attributes will be ignored. Note that if a shared executor is not specified for a connector then the connector will use a private, internal executor to provide the thread pool.对Executor元素中的名称的引用。 如果设置了此属性,并且命名的执行程序存在,则连接器将使用执行程序,并且所有其他线程属性将被忽略。 请注意,如果未为连接器指定共享执行程序,则连接器将使用专用的内部执行程序来提供线程池。
对于Tomcat 8.0的安装和配置,可以按照以下步骤进行操作: 1. 首先,从官方网站(https://tomcat.apache.org/download-80.cgi)下载Tomcat8.0的二进制文件(tar.gz或zip格式)。 2. 解压下载的文件到你想要安装Tomcat的目录。可以使用命令行或图形界面工具进行解压。 3. 打开解压后的目录,找到bin目录,在该目录下找到startup.sh(Unix/Linux)或startup.bat(Windows)文件。运行该文件来启动Tomcat服务器。 4. 默认情况下,Tomcat会在本地的8080端口上监听HTTP请求。你可以通过在Web浏览器中输入http://localhost:8080来访问Tomcat的默认首页。 5. 如果你想要修改Tomcat的端口号或其他配置,可以编辑conf目录下的server.xml文件。在该文件中,你可以找到一个<Connector>元素,其中包含端口号以及其他配置选项。 6. Tomcat还提供了一些其他的配置文件,如web.xml和context.xml,用于更详细地配置Web应用程序和上下文。你可以在conf目录下找到这些文件,并根据需要进行编辑。 7. 当你完成了对Tomcat的配置更改后,可以重新启动服务器以使更改生效。在bin目录中,可以找到shutdown.sh(Unix/Linux)或shutdown.bat(Windows)文件,运行它来停止Tomcat服务器,然后再次运行startup.sh或startup.bat来重新启动。 这些步骤应该能够帮助你完成Tomcat 8.0的安装和配置。如果你在操作过程中遇到任何问题,可以在CSDN等技术论坛上寻求帮助,或者回来向我提问。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值