### OpenLiteSpeed Web Server Users' Manual

##### Version 1.6 — Rev. 2

- License
- Introduction
- Installation
- Administration
  - Service Manager
- Security
- Configuration
  - Server General
  - Server Log
  - Server Tuning
  - Server Security
  - External Apps
  - Fast CGI App
  - Fast CGI Authorizer
  - LSAPI App
  - Servlet Engine
  - Web Server
  - Piped logger
  - Load Balancer
  - Script Handler
  - App Server Settings
  - Module Configuration
  - Listener General
  - Listener SSL
  - Virtual Host Templates
  - Virtual Host Basic
  - Virtual Host General
  - Virtual Host Security
  - Virtual Host SSL
  - Rewrite
  - Context
  - Static Context
  - Java Web App Context
  - Servlet Context
  - Fast CGI Context
  - LSAPI Context
  - Proxy Context
  - CGI Context
  - Load Balancer Context
  - Redirect Context
  - App Server Context
  - Module Handler Context
  - Web Socket Proxy
- Web Console
  - Admin Console General
  - Admin Console Security
  - Admin Listener General
  - Admin Listener SSL

# Server Tuning

## Table of Contents

### Default SHM Directory⇑

#### Description

Changes shared memory's default directory to the specified path. If the directory does not exist, it will be created. All SHM data will be stored in this directory unless otherwise specified.

#### Syntax

Path

### Max Connections⇑

#### Description

Specifies the maximum number of concurrent connections that the server can accept. This includes both plain TCP connections and SSL connections. Once the maximum concurrent connections limit is reached, the server will close Keep-Alive connections when they complete active requests.

#### Syntax

Integer number

#### Tips

When the server is started by "root" user, the server will try to adjust the per-process file descriptor limits automatically, however, if this fails, you may need to increase this limit manually.

### Max SSL Connections⇑

#### Description

Specifies the maximum number of concurrent SSL connections the server will accept. Since total concurrent SSL and non-SSL connections cannot exceed the limit specified by Max Connections, the actual number of concurrent SSL connections allowed must be lower than this limit.

#### Syntax

Integer number

### Connection Timeout (secs)⇑

#### Description

Specifies the maximum connection idle time allowed during processing one request. The connection will be closed if it has been idle, i.e. no I/O activity, for this period of time.

#### Syntax

Integer number

#### Tips

Set this as low as you can to help recover dead connections during a potential DoS attack.

#### See Also

Keep-Alive Timeout (secs)

### Max Keep-Alive Requests⇑

#### Description

Specifies the maximum number of requests that can be served through a keep-alive (persistent) session. The connection will be closed once this limit is reached. You can set this limit for each virtual host as well.

#### Syntax

Integer number

#### Tips

Set this to a reasonably high value. A value of "1" or "0" will disable keep-alive.

#### See Also

Virtual Host Max Keep-Alive Requests

### Smart Keep-Alive⇑

#### Description

Specifies whether to turn on Smart Keep-Alive. This option is effective only if Max Keep-Alive Requests is greater than 1. If enabled, you can also enable/disable it at the virtual host level. Smart keep-alive will only establish keep-alive connections for requests of JavaScript, CSS Style Sheet, and image files. For html pages, the connection will not be kept alive. This will help serve more users more efficiently. Normally a web page contains multiple images and scripts that will be cached by the browser after the initial request. It is more efficient to send those non-html static files through a single keep-alive connection and have the text/html file sent through another non-keep-alive connection. This method will reduce idle connections and in turn increase the capacity to handle more concurrent requests and users.

#### Syntax

Select from radio box

#### Tips

Enable this for high-load web sites.

#### See Also

Virtual Host Smart Keep-Alive

### Keep-Alive Timeout (secs)⇑

#### Description

Specifies the maximum idle time between requests from a keep-alive connection. If no new request is received during this period of time, the connection will be closed. This setting only applies to HTTP/1.1 connections. HTTP/2 connections have long keep-alive timeouts by design and are not affected by this setting.

#### Syntax

Integer number

#### Tips

We recommend that you set this value just long enough to wait for subsequent requests from a client when there are more assets referenced by a single page that need to be loaded. Do not set this too long hoping that the next page will be served over the keep-alive connection. Keeping many idle keep-alive connections is a waste of server resources and could be taken advantage of by (D)DoS attacks. 2-5 seconds is a reasonable range for most applications. LiteSpeed is highly efficient in a non-keep-alive environment.

### Send Buffer Size (bytes)⇑

#### Description

The sending buffer size of each TCP socket. 512K is the maximum allowed buffer size.

#### Syntax

Integer number

#### Tips

It is recommended to leave this value as "Not Set" or set to 0 to use the operating system's default buffer size.
If your web site serves large static files, increase the send buffer size to improve performance.
Setting this to a lower value will reduce throughput and memory usage per socket allowing the server to have more concurrent sockets when memory is a bottleneck.

### Receive Buffer Size (bytes)⇑

#### Description

The receiving buffer size of each TCP socket. 512K is the maximum allowed buffer size.

#### Syntax

Integer number

#### Tips

It is recommended to leave this value as "Not Set" or set to 0 to use the operating system's default buffer size.
A large receive buffer will increase performance when processing incoming requests with large payloads, i.e. file uploads.
Setting this to a lower value will reduce throughput and memory usage per socket allowing the server to have more concurrent sockets when memory is a bottleneck.

### Max Request URL Length (bytes)⇑

#### Description

Specifies the maximum size of a request URL. URL is the full text address used to access a server resource including the query string. 64K bytes is the hard limit.

#### Syntax

Integer number

#### Tips

Set it reasonably low to reduce memory usage and help identify bogus requests and DoS attacks.
2-3K is big enough for most web sites unless the HTTP GET method is used with large query strings instead of POST.

### Max Request Header Size (bytes)⇑

#### Description

Specifies the maximum size of an HTTP request header including request URL. Hard limit is 16380 bytes.

#### Syntax

Integer number

#### Tips

Set it reasonably low to reduce memory usage and help identify bogus requests and DoS attacks.
4-8K is big enough for most web sites.

### Max Request Body Size (bytes)⇑

#### Description

Specifies the maximum size of an HTTP request body. For a 32Bit OS, 2GB is the hard limit. For a 64Bit OS, it is virtually unlimited.

#### Syntax

Integer number

#### Tips

To help prevent DoS attacks, try to constrain this limit to only what is really needed. Your swapping space must have enough free space to accommodate this limit.

### Max Dynamic Response Header Size (bytes)⇑

#### Description

Specifies the maximum header size of a dynamically generated response. Hard limit is 64KB.
Default value: 16KB

#### Syntax

Integer number

#### Tips

Set it reasonably low to help recognize bad responses dynamically generated by external applications.

### Max Dynamic Response Body Size (bytes)⇑

#### Description

Specifies the maximum body size of a dynamically generated response. Hard limit is 2047MB.

#### Syntax

Integer number

#### Tips

Set the limit reasonably low to help identify bad responses. It is not uncommon to malformed scripts to contain an infinite loop which leads to infinity-sized responses.

### Max Cached Small File Size (bytes)⇑

#### Description

Specifies the largest static file that will be cached in a pre-allocated memory buffer. Static files can be served in four different ways: memory buffer cache, memory-mapped cache, plain read/write, and sendfile(). Files whose size is smaller than this setting are served from memory buffer cache. Files whose size is larger than this setting, but smaller than the Max MMAP File Size (bytes) will be served from memory-mapped cache. Files whose size is larger than the Max MMAP File Size (bytes) will be served via plain read/write or sendfile(). It is optimal to serve static files smaller than 4K from the memory buffer cache.

#### Syntax

Integer number

### Total Small File Cache Size (bytes)⇑

#### Description

Specifies the total memory that can be allocated to the buffer cache in order to cache/serve small static files.

#### Syntax

Integer number

### Max MMAP File Size (bytes)⇑

#### Description

Specifies the largest static file that will be memory mapped (MMAP). Static files can be served in four different ways: memory buffer cache, memory-mapped cache, plain read/write, and sendfile(). Files whose size is smaller than the Max Cached Small File Size (bytes) are served from memory buffer cache. Files whose size is larger than the Max Cached Small File Size (bytes), but smaller than the Max MMAP File Size will be served from memory-mapped cache. Files whose size is larger than the Max MMAP File Size will be served via plain read/write or sendfile(). Since the server has a 32bit address space (2GB), it is not recommended to memory map very large files.

#### Syntax

Integer number

### Total MMAP Cache Size (bytes)⇑

#### Description

Specifies the total memory that can be allocated for memory- mapped cache in order to cache/serve medium sized static files.

#### Syntax

Integer number

### Use sendfile()⇑

#### Description

Specifies whether to use the sendfile() system call to serve static files. Static files can be served in four different ways: memory buffer cache, memory-mapped cache, plain read/write, and sendfile(). Files smaller than the Max Cached Small File Size (bytes) are served from memory buffer cache. Files larger than the Max Cached Small File Size (bytes) but smaller than the Max MMAP File Size (bytes) will be served from memory-mapped cache. Files larger than the Max MMAP File Size (bytes) will be served via plain read/write or sendfile(). Sendfile() is a "zero copy" system call that can greatly reduce CPU utilization when serving very large static files. Sendfile() requires an optimized network card kernel driver and thus may not be suitable for some small-vendor network adapters.

#### Syntax

Select from radio box

### File ETag⇑

#### Description

Specifies whether to use a file's inode, last-modified time, and size attributes to generate the ETag HTTP response header for static files. All three attributes are enabled by default. If you plan to serve the same file out of mirrored servers, you should not include inode; otherwise, the ETag generated for one file will be different on different servers.

#### Syntax

Select from checkbox

### Enable Compression⇑

#### Description

Enables GZIP/Brotli compression for both static and dynamic responses.
Default value: Yes

#### Syntax

Select from radio box

#### Tips

Enable it to save network bandwidth. Text-based responses such as html, css, and javascript files benefit the most and on average can be compressed to half of their original size.

### Compressible Types⇑

#### Description

Specifies what MIME types are allowed to be compressed.

#### Syntax

MIME type list separated by commas. Wild card "*" and negate sign "!" are allowed, such as text/*, !text/js.

#### Example

If you want to compress text/* but not text/css, you can have a rule like text/*, !text/css. "!" will exclude that MIME type.

#### Tips

Only allow types that will benefit from GZIP/Brotli compression. Binary files such as gif/png/jpeg images and flash files do not benefit from compression.

### Enable GZIP Dynamic Compression⇑

#### Description

Controls GZIP compression for dynamically generated responses.
For this setting to have an effect, Enable Compression must be set to Yes.
Default value: Yes

#### Syntax

Select from radio box

#### Tips

Compressing dynamic responses increases CPU and memory utilization but saves network bandwidth.

### GZIP Compression Level (Dynamic Content)⇑

#### Description

Specifies the level of GZIP compression applied to dynamic content. Ranges from 1 (lowest) to 9 (highest).
This setting will only take effect when Enable Compression and Enable GZIP Dynamic Compression are enabled.
Default value: 6

#### Syntax

Number between 1 and 9.

#### Tips

Higher compression level will use more memory and CPU cycles. You can set it to a higher level if your machine has additional power. There is not much difference between 6 and 9, except that 9 uses many more CPU cycles.

### Brotli Compression Level (Dynamic Content)⇑

#### Description

Controls the level of Brotli compression applied to dynamic responses. Ranges from 0 (OFF) to 6 (highest).
This setting will only take effect when Enable Compression is enabled.
Default value: 2

#### Syntax

Number between 0 and 6.

### Auto Update Static File⇑

#### Description

Specifies whether to let the server automatically create/update GZIP/Brotli-compressed versions of compressible static files or not. If set to Yes, when a file with a MIME type listed in Compressible Types is requested, the server may create or update the corresponding compressed version of the file depending on the compressed file's timestamp. This compressed file is created under the Static Cache Directory. The filename is based on a MD5 hash of the path of the original file.
Default value: Yes

#### Syntax

Select from radio box

### GZIP Compression Level (Static File)⇑

#### Description

Specifies the level of GZIP compression applied to static files. Ranges from 1 (lowest) to 9 (highest).
This setting will only take effect when Enable Compression and Auto Update Static File are enabled.
Default value: 6

#### Syntax

Number between 1 and 9.

### Brotli Compression Level (Static File)⇑

#### Description

Specifies the level of Brotli compression applied to static files. Ranges from 1 (lowest) to 11 (highest).
This setting will only take effect when Enable Compression and Auto Update Static File are enabled.
Default value: 5

#### Syntax

Number between 1 and 11.

#### Tips

Save network bandwidth. Text-based responses such as html, css, and javascript files benefit the most and on average can be compressed to half of their original size.

### Static Cache Directory⇑

#### Description

Specifies the path of the directory used to store compressed files for static content.
Default value: Swapping Directory.

#### Syntax

Directory Path

### Max Static File Size (bytes)⇑

#### Description

Specifies the maximum size of a static file for which the server will create a compressed file automatically.
Default value: 10M

#### Syntax

Number in bytes not less than 1K.

#### Tips

It is not recommended to have the server create/update compressed files for large files. Compressing blocks an entire server process and no further requests can be processed until the compression is completed.

### Min Static File Size (bytes)⇑

#### Description

Specifies the minimum size of a static file for which the server will create a corresponding compressed file.
Default value: 200

#### Syntax

Number in bytes not less than 200.

#### Tips

It is not necessary to compress very small files as the bandwidth saving is negligible.

### SSL Strong DH Key⇑

#### Description

Specifies whether to use 2048 or 1024 bit DH keys for SSL handshakes. If set to "Yes", 2048 bit DH keys will be used for 2048 bit SSL keys and certificates. 1024 bit DH keys will still be used in other situations. Default is "Yes".
Earlier versions of Java do not support DH key size higher than 1024 bits. If Java client compatibility is required, this should be set to "No".

#### Syntax

radio

### Enable Multiple SSL Certificates⇑

#### Description

Allows listeners/vhosts to set multiple SSL certificates. If multiple certificates are enabled, the certificates/keys are expected to follow a naming scheme. If the cert is named server.crt, other possible cert names are server.crt.rsa, server.crt.dsa, server.crt.ecc. If "Not Set", defaults to "No".

#### Syntax

Select from radio box

### Enable Session Cache⇑

#### Description

Enables session ID caching using OpenSSL's default setting. Server-level setting must be set to "Yes" for Virtual Host setting to take effect.
Default values:
Server-level: Yes
VH-Level: Yes

#### Syntax

Select from radio box

### Session Cache Size (bytes)⇑

#### Description

Sets the maximum number of SSL session IDs to store in the cache. Default is 1,000,000.

#### Syntax

Integer number

### Session Cache Timeout (secs)⇑

#### Description

This value determines how long a session ID will be valid within the cache before renegotiation is required. Default is 3,600.

#### Syntax

Integer number

### Enable Session Tickets⇑

#### Description

Enables session tickets using OpenSSL's default session ticket setting. Server-level setting must be set to "Yes" for Virtual Host setting to take effect.
Default values:
Server-level: Yes
VH-Level: Yes

#### Syntax

Select from radio box

### SSL Session Ticket Lifetime (secs)⇑

#### Description

This value determines how long a session ticket will be valid before a renegotiation is required. Default is 3,600.

#### Syntax

Integer number

### SSL Session Ticket Key File⇑

#### Description

Allows the SSL Ticket Key to be created/maintained by an administrator. The file must be 48 bytes long. If this option is left empty, the load balancer will generate and rotate its own set of keys.
IMPORTANT: To maintain forward secrecy, it is strongly recommended to change the key every SSL Session Ticket Lifetime seconds. If this cannot be done, it is recommended to leave this field empty.

#### Syntax

Path

### Enable QUIC⇑

#### Description

Enables the QUIC network protocol server wide. Default value is Yes.

#### Syntax

Select from radio box

#### Tips

When this setting is set to Yes, QUIC can still be disabled at the listener level through the Allow QUIC setting, or at the virtual host level through the Enable QUIC setting.

### QUIC SHM Directory⇑

#### Description

Specifies the directory used to save QUIC data to shared memory.
By default, the server's default SHM directory, /dev/shm, will be used.

#### Syntax

Path

#### Tips

A RAM based partition, such as /dev/shm, is recommended.

### QUIC Versions⇑

#### Description

A list of enabled QUIC versions. This setting should only be used to limit QUIC support to the versions listed and is best left blank.

#### Syntax

Comma-separated list

#### Example

Q035, Q039

#### Tips

It is recommended to leave this setting blank to have the the best configuration applied automatically.

### Congestion Control⇑

#### Description

The congestion control algorithm used. This can be set manually or left up to the QUIC library in use by selecting the "Default" option.
Default value: Default

#### Syntax

Select from drop down list

### Connection Flow Control Window⇑

#### Description

The initial size of the buffer allocated for a QUIC connection. Default value is 1.5M.

#### Syntax

Number between 64K and 512M

#### Tips

A larger window size will use more memory.

### Max Connection Flow Control Window⇑

#### Description

Specifies the maximum size that a connection flow control window buffer is allowed to reach due to window auto-tuning.
Default value is 0, which means that the value of Connection Flow Control Window is used and no auto-tuning is performed.

#### Syntax

0 or a number between 64K and 512M

#### Tips

A larger window size will use more memory.

### Stream Flow Control Window⇑

#### Description

The initial amount of data a QUIC connection is willing to receive per stream. Default value is 1M.

#### Syntax

Number between 64K and 128M

#### Tips

A larger window size will use more memory.

### Max Stream Flow Control Window⇑

#### Description

Specifies the maximum size that a stream flow control window is allowed to reach due to window auto-tuning.
Default value is 0, which means that the value of Stream Flow Control Window is used and no auto-tuning is performed.

#### Syntax

0 or a number between 64K and 128M

#### Tips

A larger window size will use more memory.

### Max Concurrent Streams Per Connection⇑

#### Description

The maximum number of concurrent streams allowed per QUIC connection. Default value is 100.

#### Syntax

Integer number between 10 and 1000

### Handshake Timeout⇑

#### Description

The time in seconds a new QUIC connection is given to complete its handshake, after which the connection is aborted. Default value is 10.

#### Syntax

Integer number between 1 and 15

### Idle Timeout⇑

#### Description

The time in seconds after which an idle QUIC connection will be closed. Default value is 30.

#### Syntax

Integer number between 10 and 30