## OpenLiteSpeed Web Server Users' Manual

### Version 1.7 — Rev. 18

- 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

# 外部应用

LiteSpeed网络服务器可以转发外部应用程序的请求，以处理和生成动态内容。 从2.0版本起, LiteSpeed Web Server已经支持了7种外部应用: CGI, FastCGI, web server, servlet engine, LiteSpeed SAPI application, load balancer, and piped logger.

- CGI是Common Gateway Interface的缩写. 目前的标准是 CGI/1.1. CGI应用程序在独立的进程中运行. 一个CGI进程将为每个请求启动,并且在完成请求后退出.
- FastCGI 是一个快速,开源,安全的web服务器接口,它解决了CGI固有的性能问题,而没有引入专有API(应用编程接口), 对于更多的信息,请访问 http://www.fastcgi.com. 在 LiteSpeed Web Server, FastCGI 应用可以发挥两种作用: 创造动态响应 (响应者角色) 或者 授权请求 (授权者的角色). LiteSpeed Web Server进一步定义了两种类型的FastCGI应用程序:本地FastCGI和远程FastCGI. Web服务器可根据需要自动启动本地FastCGI应用程序. Web服务器不会启动远程FastCGI应用程序。 (它们可以在远程计算机或同一计算机上运行)
- Web服务器是指支持HTTP 1.0/1.1协议的服务器应用程序. LiteSpeed网络服务器可以作为一个透明的反向代理来加速和保护网络服务器和应用服务器. 在与后端网络服务器进行通信时，LiteSpeed将始终尝试利用持久连接，以实现最高性能。
- 像Apache Tomcat和Jetty,servlet引擎是实现了Java servlets和Java Server Pages的应用程序. LiteSpeed可以通过AJPv1.3（Apache JServ协议1.3版）与servlet引擎进行通信. Servlet引擎不能由Web服务器启动，可以设置在远程机器上运行.
- A LiteSpeed SAPI (LiteSpeed Server Application Programming Interface) application is an application that communicates with LiteSpeed Web Server through LSAPI, a fast, scalable server interface specifically designed for LiteSpeed Web Server to achieve maximum efficiency. LSAPI's mechanism of action are similar to FastCGI, but LSAPI applications can be up to 30% faster than comparable FastCGI applications. LSAPI is highly recommended over FastCGI for supported applications. (LSAPI currently supports applications written in PHP, Ruby, and Python.) For more information about LSAPI, please visit https://www.litespeedtech.com/open-source/litespeed-sapi .
- A load balancer is a virtual external application, which assigns requests to backend worker applications based on workload. Worker applications can be CGI, FastCGI, web server, servlet engine, or LSAPI applications. Different types of applications can be mixed together under one load balancer. Load balancers and piped loggers cannot be used as worker applications.
- A piped logger is an application that can process access logs in real-time, writing an access log into database or performing real-time statistics calculations, for example.

Unlike CGI applications, FastCGI applications, LSAPI applications, and servlet engine do not exit after processing a request. The application process will stay/persist and serve as many requests as it can. The socket connection can be reused for multiple requests as well. External applications can be set up in the {PAGE=ExtApp_Help} section. External applications cannot, however, function on their own. Additional settings must be configured so that the web server knows which requests to send to which application. There are two ways to to configure this in LiteSpeed Web Server:

1. Set the external application as a handler for a specific context.
2. Set the external application as a handler of a script language via file suffix binding.

FastCGI applications, LSAPI applications, web servers, servlet engines, and load balancers have to be defined in the {PAGE=ExtApp_Help} section before you can configure them to handle a context or script suffix. It is not necessary to define CGI applications in the {PAGE=ExtApp_Help} section. External applications can be configured at the server level or at the virtual host level. When configured at the server level, the application can be used by all virtual hosts. When configured at the virtual host level, it can only be used by that virtual host.

## Table of Contents

### 类型⇑

#### Description

指定外部应用程序的类型。 应用程序类型根据它们提供的服务或与服务器通信所使用的协议而有所不同。 从中选择

- FastCGI: a FastCGI application with a Responder role.
- FastCGI Authorizer: a FastCGI application with an Authorizer role
- Servlet Engine: a servlet engine with an AJPv13 connector, such as Tomcat.
- Web Server: a web server or application server that supports HTTP protocol.
- LiteSpeed SAPI App: an application that communicates with the web server using LSAPI protocol.
- Load Balancer: a virtual application that can balance load among worker applications.
- Piped Logger: an application that can process access log entries received on its STDIN stream.

#### Syntax

从列表中选择

#### 提示

Most applications will use either LSAPI or FastCGI protocol. LSAPI supports PHP, Ruby, and Python. Perl can be used with FastCGI. (PHP, Ruby, and Python can also be set up to run using FastCGI, but they run faster using LSAPI.) Java uses servlet engines.