OpenLiteSpeed Web Server Users' Manual

Version 1.4 Rev. 2

Virtual Host General

Table of Contents

General

文档根 | 管理员邮箱 | 启用GZIP | 启用IP地理定位 | SPDY Advertisement | 

虚拟主机日志

使用服务器日志 | File Name | 日志级别 | 回滚大小 | 

访问日志

日志管理 | File Name | Piped Logger | 日志格式 | 记录头部 | 回滚大小 | 保留天数 | 字节记录 | 压缩存档 | 

Index Files

使用服务器索引文件 | 索引文件 | 自动索引 | 自动索引URI | 

Customized Error Pages

错误代码 | URL | 

Expires Settings

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

File Upload

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

Script Handler Definition

Suffix | 类型 | 处理器名称 | 

Expire Settings

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

文档根Go to top

Description

指定此虚拟主机的文档根目录。 推荐使用$VH_ROOT/html。在context中,此目录可以用$DOC_ROOT来引用。

Syntax

路径3

管理员邮箱Go to top

Description

指定这个虚拟主机管理员的电子邮箱地址。

Syntax

Comma separated list of email addresses

启用GZIPGo to top

Description

指定是否启用此虚拟主机的gzip压缩功能。 这项设置只有在服务器级别的GZIP压缩功能启用时才有效。 在服务器级别开启压缩的情况下,可以通过此选项关闭本虚拟主机的压缩。 压缩设置是在服务器级别配置的(在Tuning-GZIP选项中)。

Syntax

布尔值

See Also

启用压缩, 压缩级别(静态内容), 启用动态压缩, 压缩级别(动态内容)

启用IP地理定位Go to top

Description

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

Syntax

布尔值

See Also

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

SPDY AdvertisementGo to top

Description

Specifies whether to advertise to clients that SPDY protocol is available. If set, LSWS will send an Alternate-Protocol response header when a client accesses SPDY-enabled websites through an HTTP connection. This requires the website to have both HTTP and HTTPS connections set up, and SPDY support enabled.

Syntax

port:protocol string

Example

If SPDY/3 is enabled on port 443, you can set the string to "443:npn-spdy/3"

使用服务器日志Go to top

Description

指定是否将虚拟主机的日志信息放置到服务器日志文件中,而不是创建独自的日志文件。

Syntax

布尔值

File NameGo to top

Description

Specifies the path for the log file.

Syntax

Filename which can be an absolute path or a relative path to $SERVER_ROOT, $VH_ROOT.

Tips

[Performance] Place the log file on a separate disk.

日志级别Go to top

Description

指定日志记录级别。可用级别(从高到低)为ERROR, WARNING, NOTICE, INFO, 和 DEBUG。 只有当消息等级高于或与当前设置相同时才被记录。 如果您希望将此设置为DEBUG,您也需要设置服务器日志级别为DEBUG。 调试的级别只能在服务器级别通过调试级别控制。

Syntax

选项

Tips

[性能建议] 除非调试级别设置为NONE以外的日志级别, 否则DEBUG级别不会对性能产生任何影响,推荐采用。

See Also

调试级别

回滚大小Go to top

Description

指定何时日志文件需要回滚,也称为日志循环。 当文件大小超过回滚限制后,在使用的日志文件将在同一目录中被重命名 为log_name.mm_dd_yyyy(.sequence),一个新的日志文件将被创建。 回滚的日志文件的实际大小有时会比限制值稍微大一些。 将值设置为0将禁用日志循环。

Syntax

无符号整数

Tips

请用“K”,“M”,“G”代表千字节,兆字节和千兆字节。

日志管理Go to top

Description

指定写入访问日志的地点。这里有三个选项: 1. 写入到服务器的访问日志; 2. 为虚拟主机创建一个访问日志; 3. 禁用访问日志记录。

Syntax

选项

File NameGo to top

Description

The access log filename.

Syntax

Filename which can be an absolute path or a relative path to $SERVER_ROOT, $VH_ROOT.

Tips

[Performance] Put access log file on a separate disk.

Piped LoggerGo to top

Description

Specifies the external application that will receive the access log data sent by LiteSpeed through a pipe on its STDIN stream (file handle is 0). When this field is specified, the access log will be sent only to the logger application and not the access log file specified in previous entry.

The logger application must be defined in External Application section first. Server-level access logging can only use an external logger application defined at the server level. Virtual host-level access logging can only use a logger application defined at the virtual host level.

The logger process is spawned in the same way as other external (CGI/FastCGI/LSAPI) processes. This means it will execute as the user ID specified in the virtual host's 外部应用程序设置UID模式 settings and will never run on behalf of a privileged user.

LiteSpeed web server performs simple load balancing among multiple logger applications if more than one instance of a logger application is configured. LiteSpeed server always attempts to keep the number of logger applications as low as possible. Only when one logger application fails to process access log entries in time will the server attempt to spawn another instance of the logger application.

If a logger crashes, the web server will start another instance but the log data in the stream buffer will be lost. It is possible to lose log data if external loggers cannot keep up with the speed and volume of the log stream.

Syntax

Select from drop down list

日志格式Go to top

Description

指定访问日志的格式。 设置之后,它将覆盖记录头部 的设定。

Syntax

字符串。日志格式的语法与Apache 2.0自定义 日志格式兼容。

Example

一般日志格式(CLF)
"%h %l %u %t \"%r\" %>s %b"

支持虚拟主机的一般日志格式
"%v %h %l %u %t \"%r\" %>s %b"

NCSA扩展/组合日志格式
"%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"

记录Foobar的cookie值
"%{Foobar}C"

See Also

记录头部

记录头部Go to top

Description

指定是否记录HTTP请求头: RefererUserAgentHost

Syntax

复选框

Tips

[性能建议] 如果你不需要在访问日志中记录这些头部信息,关闭这个功能。

See Also

日志格式

保留天数Go to top

Description

指定访问日志文件将被保存在磁盘上多少天。 只有超出指定天数的回滚日志文件会被删除。 当前的日志文件不会被删除,无论它包含了多少天的数据。 如果你不想自动删除过时的、很旧的日志文件, 将该值设置为0

Syntax

无符号整数

字节记录Go to top

Description

指定带宽字节日志文件的路径。设置后,将创建一份兼容cPanel面板的带宽日志。这将记录 一个请求传输的总字节数,包括请求内容和响应内容。

Syntax

文件2

Tips

[性能建议] 将日志文件放置在一个单独的磁盘上。

压缩存档Go to top

Description

指定是否压缩回滚日志以节省磁盘空间。

Syntax

布尔值

Tips

日志文件是高度可压缩的,建议采取压缩以减少旧日志的磁盘占用量。

使用服务器索引文件Go to top

Description

指定是否使用服务器的索引文件。 如果设置为Yes,那么只有服务器的设置将被使用。 如果设置为No,那么服务器的设置将不会被使用。 如果设置为Addition,那么附加的索引文件可以被添加到此虚拟主机服务器的索引文件列表中。 如果想要禁用此虚拟主机的索引文件,您可以将该值设置为No,并将索引文件栏留空。

Syntax

选项

索引文件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

索引文件, 自动索引

Customized Error PagesGo to top

Description

Whenever the server has a problem processing a request, the server will return an error code and an html page as an error message to the web client. Error codes are defined in the HTTP protocol (see RFC 2616). LiteSpeed web server has a built-in default error page for each error code, but a customized page can be configured for each error code as well. These error pages can be even further customized to be unique for each virtual host.

错误代码Go to top

Description

指定错误页面的HTTP状态码。 只有特定的HTTP状态码才可以自定义错误页面。

Syntax

选项

URLGo to top

Description

指定自定义错误页的URL。 当返回相应HTTP状态时服务器会将请求转发到该URL。 如果此URL指向一个不存在的地址,自带的错误页面将被使用。 该URL可以是一个静态文件,动态生成的页面,或者其他网站的页面 (网址开头为"http(s): //")。 当转发到在其他网站上的页面时,客户端会收到一个重定向状态码 来替代原本的状态码。

Syntax

URL

启用过期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.

SuffixGo to top

Description

Specifies the script file suffixes that will be handled by this script handler. Suffixes must be unique.

Syntax

Comma delimited list with period "." character prohibited.

Tips

The server will automatically add a special MIME type ("application/x-httpd-[suffix]") for the first suffix in the list. For example, MIME type "application/x-httpd-php53" will be added for suffix "php53". Suffixes after the first need to set up in the MIME设置 settings.
Though we list suffixes in this field, the script handlers use MIME types, not suffixes, to decide which scripts to handle.
[Performance & Security] Only specify the suffixes you really need.

类型Go to top

Description

指定处理这些脚本文件的外部程序类型。 可用类型有:CGI, FastCGI, Web服务器, LSAPI应用程序, 负载均衡器, 或 Servlet引擎。 对于FastCGI, Web服务器和Servlet引擎,需要指定处理器名称。 这是在External Application部分预设定的外部程序名称。

Syntax

选项

处理器名称Go to top

Description

当处理器类型为FastCGI,Web服务器,LSAPI,负载均衡器或Servlet引擎时, 指定处理脚本文件的外部程序名称。

Syntax

选项