Fast CGI App

Table of Contents

名称 | 地址 | 最大连接数 | 环境 | 初次请求超时时间 (secs) | 重试超时时间 (secs) | 持久连接 | 持久连接超时时间 | Response Buffering | Start By Server | 命令 | Back Log | Instances | Run As User | Run As Group | umask | Run On Start Up | Max Idle Time | Priority | 内存软限制 (bytes) | 内存硬限制 (bytes) | Process Soft Limit | 进程硬限制

名称

Description

此外部应用程序的唯一名称。 在配置的其他部分中使用该名称时,将使用该名称进行引用。

地址

Description

外部应用程序使用的唯一套接字地址。 支持IPv4/IPv6套接字和Unix域套接字(UDS)。 IPv4/IPv6套接字可用于网络通信。 只有当外部应用程序与服务器在同一台机器上时,才能使用UDS。

Syntax

IPv4 或 IPV6 address:port 或者 UDS://path

例子

127.0.0.1:5434
UDS://tmp/lshttpd/php.sock.

提示

[安全建议] 如果外部应用程序在同一台机器上运行,则首选UDS。如果必须使用IPv4|IPV6, 将IP地址设置为localhost127.0.0.1,这样外部应用就无法从其他机器上访问。 [性能建议] Unix域套接字一般比IPv4套接字拥有更高的性能。

最大连接数

Description

指定服务器与外部应用之间可建立的最大并发连接数。该设置控制外部应用程序可同时处理多少个请求。 然而,真正的限制还取决于外部应用本身。如果外部的速度不够快,或者无法处理大量的并发请求,那么将这个值设置得更高也无济于事。

Syntax

整数

提示

[性能建议] 设置一个高值并不能直接变成高性能。设置为一个不会使外部应用程序过载的值,将提供最佳的性能/吞吐量。

环境

Description

为外部应用程序指定额外的环境变量。

Syntax

Key=value. Multiple variables can be separated by "ENTER"

初次请求超时时间 (secs)

Description

指定服务器等待外部应用响应新建立的连接的第一个请求的最大时间 如果服务器在这个限制时间内没有收到外部应用的任何数据,它将把这个连接标记为坏(Bad)。这有助于识别与外部应用程序的通信问题。 这有助于尽快发现与外部应用的通信问题。如果某些请求的处理时间较长,则增加这个限制以避免503错误信息。

Syntax

整数

重试超时时间 (secs)

Description

指定服务器在重试之前,等待出现通信问题的外部应用程序的时间。

Syntax

整数

持久连接

Description

指定在处理完请求后是否要保持连接 持久连接可以提高性能, 但某些FastCGI外部应用程序不完全支持持久连接。默认为 "On"。

Syntax

从单选框选择

持久连接超时时间

Description

指定保持持久连接的最大时间,以秒为单位。

如果设置成"-1",连接将不会超时. 当设置成0或者更大, 连接将在这些秒数后被关闭。

Syntax

int

Response Buffering

Description

Specifies whether to buffer responses received from external applications. If a "nph-" (Non-Parsed-Header) script is detected, buffering is turned off for responses with full HTTP headers.

Syntax

从列表中选择

Start By Server

Description

Specifies whether you want the web server to start the application automatically. Only FastCGI and LSAPI applications running on the same machine can be started automatically. The IP in the 地址 must be a local IP. Starting through the LiteSpeed CGI Daemon instead of a main server process will help reduce system overhead.

Default value: Yes (Through CGI Daemon)

Syntax

从列表中选择

命令

Description

Specifies the full command line including parameters to execute the external application. Required value if Start By Server is enabled. A parameter should be quoted with a double or single quote if the parameter contains space or tab characters.

Syntax

Full path to the executable with optional parameters.

See Also

Start By Server

Back Log

Description

Specifies the backlog of the listening socket. Required if Start By Server is enabled.

Syntax

整数

Instances

Description

Specifies the maximum instances of the external application the server will create. It is required if Start By Server is enabled. Most FastCGI/LSAPI applications can only process one request per process instance and for those types of applications, instances should be set to match the value of 最大连接数. Some FastCGI/LSAPI applications can spawn multiple child processes to handle multiple requests concurrently. For these types of applications, instances should be set to "1" and environment variables used to control how many child processes the application can spawn.

Syntax

整数

Run As User

Description

The external application will run as this specified user name. If not set, Virtual Host level settings will be inherited.

Default value: Not Set

Syntax

Valid username.

See Also

extGroup

Run As Group

Description

The external application will run as this specified group name. If not set, Virtual Host level settings will be inherited.

Default value: Not Set

Syntax

Valid group name.

See Also

extUser

umask

Description

Sets default umask for this external application's processes. See man 2 umask for details. The default value taken from the server-level umask setting.

Syntax

value valid range [000]-[777].

See Also

CGI umask

Run On Start Up

Description

Specifies whether to start the external application at server start up. Only applicable to external applications that can manage their own child processes and where Instances value is set to "1".

If enabled, external processes will be created at server startup instead of run-time.

When selecting "Yes (Detached mode)", all detached process can be restarted at the Server level or Virtual Host level by touching the '.lsphp_restart.txt' file under the $SERVER_ROOT/admin/tmp/ or $VH_ROOT/ directory respectively.

Default value: Yes (Detached mode)

Syntax

从单选框选择

提示

If the configured external process has significant startup overhead, like a Rails app, then this option should be enabled to decrease first page response time.

Max Idle Time

Description

Specifies the maximum idle time before an external application is stopped by the server, freeing idle resources. When set to "-1", the external application will not be stopped by the server unless running in ProcessGroup mode where idle external applications will be stopped after 30 seconds. The default value is "-1".

Syntax

从单选框选择

提示

This feature is especially useful in the mass hosting environment where, in order to prevent files owned by one virtual host from being accessed by the external application scripts of another virtual host, many different applications are run at the same time in SetUID mode. Set this value low to prevent these external applications from idling unnecessarily.

Priority

Description

Specifies priority of the external application process. Value ranges from -20 to 20. A lower number means a higher priority. An external application process cannot have a higher priority than the web server. If this priority is set to a lower number than the server's, the server's priority will be used for this value.

Syntax

int

See Also

Server 优先级

内存软限制 (bytes)

Description

以字节为单位指定服务器启动的外部应用进程或程序的内存占用限制。

此限制的目的主要是为了防范软件缺陷或蓄意攻击造成的过度内存使用, 而不是限制正常使用。确保留有足够的内存,否则您的应用程序可能故障并 返回503错误。限制可以在服务器级别或独立的外部应用程序级别设置。如 果未在独立的外部应用程序级别设定限制,将使用服务器级别的限制。

如果在两个级别都没有设置该限制,或者限制值设为0,将使用操 作系统的默认设置。

Syntax

整数

提示

[注意] 不要过度调整这个限制。如果您的应用程序需要更多的内存, 这可能会导致503错误。

内存硬限制 (bytes)

Description

内存软限制 (bytes)非常相同,但是在一个用户进程中,软限制 可以被放宽到硬限制的数值。硬限制可以在服务器级别或独立的外部应用程序级别设 置。如果未在独立的外部应用程序级别设定限制,将使用服务器级别的限制。

如果在两个级别都没有设置该限制,或者限制值设为0,将使用操 作系统的默认设置。

Syntax

整数

提示

[注意] 不要过度调整这个限制。如果您的应用程序需要更多的内存, 这可能会导致503错误。

Process Soft Limit

Description

Limits the total number of processes that can be created on behalf of a user. All existing processes will be counted against this limit, not just new processes to be started.

The limit can be set at the server level or at an individual external application level. The server-level limit will be used if it is not set at an individual application level. The operating system's default setting will be used if this value is 0 or absent at both levels.

Syntax

整数

提示

PHP scripts can call for forking processes. The main purpose of this limit is as a last line of defense to prevent fork bombs and other attacks caused by PHP processes creating other processes.

Setting this setting too low can severely hurt functionality. The setting will thus be ignored below certain levels.

When Run On Start Up is set to "Yes (Daemon mode)", the actual process limit will be higher than this setting to make sure parent processes are not limited.

进程硬限制

Description

Process Soft Limit非常相同,但是,在用户进程中软限制 可以被放宽到硬限制的数值。硬限制可以在服务器级别或独立的外部应用程序级别设 置。如果未在独立的外部应用程序级别设定限制,将使用服务器级别的限制。 如果在两个级别都没有设置该限制,或者限制值设为0,将使用操 作系统的默认设置。

Syntax

整数