OpenLiteSpeed Web Server Users' Manual

Version 1.4 Rev. 2

Server General

General settings for the whole server. When path information is required in a setting, it can be either absolute or relative to $SERVER_ROOT. $SERVER_ROOT is the location where LiteSpeed web server has been installed (your_home_dir/lsws or /opt/lsws, for example). The server executable is under $SERVER_ROOT/bin.

Table of Contents

Server Process

服务器名称 | Number of Workers | Running As | 优先级 | 最大的读写缓冲区大小 | 交换目录 | 自动修复503错误 | Enable HTTP/2 Over Cleartext TCP | 平滑重启超时时长 | Statistics Output Directory | 

General Settings

MIME设置 | 后缀 | MIME类型 | Disable Initial Log Rotation | 服务器签名 | 启用IP地理定位 | 使用报头中的客户端IP | 管理员电子邮箱 | 

索引文件

索引文件 | 自动索引 | 自动索引URI | 

Expires Settings

启用过期 | 默认过期 | 按类型过期 | 

File Upload

Temporary File Path | Temporary File Permissions | Pass Upload Data by File Path | 

IP地理定位数据库

数据库文件路径 | 数据库缓存类型 | 

服务器名称Go to top

Description

该服务器的唯一名称。您可以在此填写 $HOSTNAME 。

Syntax

文本

Number of WorkersGo to top

Description

Specifies the number of httpd workers.

Syntax

Integer value between 1 and 16.

Tips

[Performance] Set an appropriate number to suit your needs. Adding more workers may not necessarily mean better performance.

Running AsGo to top

Description

Specifies the user/group that the server process runs as. This is set using the parameters "--with-user" and "--with-group" when running the configure command before installation. To reset these values, you must rerun the configure command and reinstall.

Apply

Reinstall required.

Tips

[Security] Server should not run as a privileged user such as "root". It is critical that the server is configured to run with a un-privileged user/group combination that does not have login/shell access. A user/group of nobody is generally a good choice.

优先级Go to top

Description

指定服务进程的优先级。数值范围从 -2020。数值越小,优先级越高。

Syntax

整数

Tips

[性能建议] 通常在繁忙的服务器上,较高的优先级会得到性能的小幅提升。 不要设置比数据库进程更高的优先级。

See Also

External App Priority, CGI优先级

最大的读写缓冲区大小Go to top

Description

指定用于存储请求内容和相应的动态响应的最大缓冲区大小。达到此限制时, 服务器将在交换目录中创建临时交换文件。

Syntax

无符号整数

Tips

[性能] 设置足够大的缓冲区,以容纳所有并发 请求/响应,避免内存和磁盘数据交换。如果交换目录(默认为/tmp/lshttpd/swap/)存在频繁的读写活动,说明缓冲区太小,LiteSpeed正在使用交换文件。

See Also

交换目录

交换目录Go to top

Description

指定交换文件的存放目录。 服务器在chroot模式启动时,该路径相对于新的根目录, 否则,它相对于真正的根目录。

Litespeed使用自己的虚拟内存 以降低系统的内存使用量。虚拟内存和磁盘交换会用来存储大的请求内容和 动态响应。交换目录应设置在有足够剩余空间的磁盘上。

Syntax

绝对路径

Tips

[性能建议] 将交换目录设置在一个单独的磁盘上,或者增加最大读写缓冲区大小以避免交换。

See Also

最大的读写缓冲区大小

自动修复503错误Go to top

Description

指定是否尝试通过平滑重启LiteSpeed修复“503 服务不可用”错误。“503”错误通常是由 发生故障的外部应用程序引起的,Web服务器重新启动往往可以临时修复 错误。如果启用,当30秒内出现超过30次“503”错误时,服务器将自动 重新启动。此功能是默认启用的。

Syntax

布尔值

Enable HTTP/2 Over Cleartext TCPGo to top

Description

Specifies whether to enable HTTP/2 over non-encrypted TCP connections. Default is disabled.

Syntax

Select from radio box

平滑重启超时时长Go to top

Description

平滑重启时,即使新的服务器实例已经启动,旧的实例仍将继续 处理现有的请求。此项超时设置定义了旧实例等待多长时间后中止。 默认值是300秒。 -1表示永远等待。 0表示不等待,立即中止。

Syntax

整数

Statistics Output DirectoryGo to top

Description

The directory where the Real-Time Stats report file will be written. The default directory is /tmp/lshttpd/ .

Syntax

绝对路径

Tips

During server operation, the .rtreport file will be written to every second. To avoid unnecessary disk writes, set this to a RAM Disk.
The .rtreport file can be used with 3rd party monitoring software to track server health.

MIME设置Go to top

Description

为此服务器指定包含MIME设置的文件。 在chroot模式中提供了绝对路径时,该文件路径总是相对于真正的根。 点击文件名可查看/编辑详细的MIME项。

Syntax

文件2

Tips

Click the filename to edit the MIME settings.

后缀Go to top

Description

你可以列出相同MIME类型的多个后缀,用逗号分隔。

MIME类型Go to top

Description

一个MIME类型由一个类型和子类型组成,格式为“类型/子类型”。

Disable Initial Log RotationGo to top

Description

Specifies whether to enable/disable rotation of server error log file at startup. Initial log rotation is enabled by default when using value "Not Set".

Syntax

Select from radio box

服务器签名Go to top

Description

指定是否在响应头的Server参数中显示服务器签名和版本号。 有三个选项: 当设置为Hide Version时、只显示LiteSpeed。当设置为 Show Version,显示LiteSpeed和版本号。 设置为Hide Full Header时,整个Server头都不会显示在响应报头中。

Syntax

布尔值

Tips

[安全建议] 如果你不想暴露服务器的版本号,设置为Hide Version

启用IP地理定位Go to top

Description

指定是否启用IP地理定位查找。 可以在服务器级别,虚拟主机级别,或context级别设置。

Syntax

布尔值

See Also

使用报头中的客户端IP, 数据库文件路径, 数据库缓存类型

使用报头中的客户端IPGo to top

Description

指定是否将在HTTP请求报头中的X-Forwarded-For参数列出的IP地址,用于 所有的IP地址相关的功能,包括 连接/带宽限制、访问控制和IP地理定位。

如果你的Web服务器放置在负载均衡器或代理服务器之后,此功能非常有用。 如果您选择了“仅限受信任的IP”,只有在请求来自受信任IP时,X-Forwarded-For 中的IP才会被使用。受信任IP可在服务器级别的允许列表中定义。

Syntax

选项

管理员电子邮箱Go to top

Description

指定服务器管理员的电子邮箱地址。 如果设置了电子邮箱地址,管理员将收到重要事件的电子邮件通知(例如, LiteSpeed服务因崩溃而自动重启或者授权即将过期)。

Syntax

逗号分隔的电子邮箱地址列表。

Tips

电子邮件提醒功能只在服务器拥有有效的邮件服务时才能正常工作,如postfix、exim或sendmail。

索引文件Go to top

Description

指定URL映射到目录时顺序查找的索引文件名称。 您可以在服务器、虚拟主机和Context级别对其进行自定义。

Syntax

逗号分隔的索引文件名列表。

Tips

[性能建议] 只设置你需要的索引文件。

自动索引Go to top

Description

在目录中,当索引文件中所列的索引文件不可用时,指定运行时是否即时生成目录索引。
此选项可以在虚拟主机级别和context级别中设置,并可以顺着目录树继承,直到被覆盖。 您可以自定义生成的索引页面。请访问在线百科了解如何操作。

Syntax

布尔值

Tips

[安全建议] 建议关闭自动索引,从而尽可能防止泄露机密数据。

See Also

索引文件, 自动索引URI

自动索引URIGo to top

Description

在目录中,当索引文件中所列出的索引文件(index)不可用时,指定用来生成索引页面的URI。 LiteSpeed Web服务器使用一个外部脚本来生成索引页面,从而为定制提供最大的灵活性。 默认的脚本生成一个类似于Apache的索引页面。 定制生成的索引页,请访问在线百科。 被索引的目录通过一个环境变量 "LS_AI_PATH"来传递给脚本。

Syntax

URI

See Also

索引文件, 自动索引

启用过期Go to top

Description

指定是否为静态文件生成Expires头。如果启用,将根据 默认过期按类型过期生成Expires头。

这可以在服务器,虚拟主机和Context级别设置。低级别的设置将 覆盖高级别的设置。例如,Context级别的设置将覆盖虚拟主机级别的设置, 虚拟主机级别的设置将覆盖服务器级别的设置。

Syntax

布尔值

默认过期Go to top

Description

指定生成Expires头的默认设置。该设置在启用过期 设为“启用”时有效。它可以被按类型过期覆盖。 除非必要,否则不要在服务器或虚拟主机级别设置该默认值。 因为它会为所有网页生成Expires头。大多数时候,应该是 为不常变动的某些目录在Context级别设置。如果没有默认设置,按类型过期中未指定的类型不会生成Expires头。

Syntax

A|M秒数
文件将在基准时间(A|M)加指定秒数的时间后失效。 “A”代表基准时间为客户端的访问时间,“M”代表文件的最后修改时间。

按类型过期Go to top

Description

为各个MIME类型分别指定Expires头设置。

Syntax

逗号分隔的“MIME-类型=A|M秒数”的列表。 文件将在基准时间(A|M)加指定秒数的时间后失效。

“A”代表基准时间为客户端的访问时间,“M”代表文件的最后修改时间。 MIME-类型可使用通配符“*”,如image/*。

File UploadGo to top

Description

Provides additional security functionality when uploading files by using a Request Body Parser to parse files to a server local directory where they can be easily scanned for malicious intent by third party modules. Request Body Parser is used when Pass Upload Data by File Path is enabled or a module calls LSIAPI’s set_parse_req_body in the LSI_HKPT_HTTP_BEGIN level. API examples provided in source package.

See Also

Hook::HTTP_BEGIN Priority

Temporary File PathGo to top

Description

Temporary directory where files being uploaded to server will be stored while request body parser is working. Default value is /tmp/lshttpd/.

Syntax

Absolute path or path starting with $SERVER_ROOT (for Server and VHost levels) or $VH_ROOT (for VHost levels).

Temporary File PermissionsGo to top

Description

Determines file permissions used for files stored in temporary directory. Server level setting is global, can be overridden at VHost level.

Syntax

3 digits octet number. Default value is 666.

Pass Upload Data by File PathGo to top

Description

Specify whether or not to pass upload file data by path. If enabled, file path along with some other information is sent to backend handler instead of file itself when uploading. This saves on CPU resources and file transfer time but requires some updates to backend to implement. If disabled, file content will be transferred to backend handler, request body is still parsed to files.

Syntax

Select from radio box

Tips

[performance] Enable this to speed up file upload processing if backward compatibility is not an issue.

IP地理定位数据库Go to top

Description

多个MaxMind地理定位数据库可以在这里指定。MaxMind有以下数据库类型: 国家,地区,城市,组织,ISP和NETSPEED。如果混合配置“国家”,“地区”,和“城市”类型数据库,则最后一项将会生效。

数据库文件路径Go to top

Description

指定MaxMind GeoIP数据库路径。

Syntax

文件路径

数据库缓存类型Go to top

Description

指定应该使用什么样的缓存模式。缓存模式包括: 标准缓存、内存缓存、检查缓存和索引缓存。内存缓存是推荐的模式,也是默认模式。

Syntax

选项