Read More

External Apps

LiteSpeed web server can forward requests to external applications to process and generate dynamic content. Since 2.0, LiteSpeed Web Server has supported seven types of external applications: CGI, FastCGI, web server, servlet engine, LiteSpeed SAPI application, load balancer, and piped logger.
  • CGI stands for Common Gateway Interface. The current standard is CGI/1.1. CGI applications run in standalone processes. A CGI process is started for each request and will exit after finishing the request.
  • FastCGI is a fast, open, and secure web server interface that solves the performance problems inherent in CGI without introducing the overhead and complexity of proprietary APIs (Application Programming Interfaces). For more information, please visit https://fastcgi-archives.github.io/. On LiteSpeed Web Server, FastCGI applications can take two roles: generating dynamic responses (a responder role) or authorizing requests (an authorizer role). LiteSpeed Web Server further defines two types of FastCGI applications: local FastCGI and remote FastCGI. Local FastCGI applications are started automatically by the web server on demand. Remote FastCGI applications are not started by the web server. (They can run on a remote machine or on the same machine.)
  • A web server is a server application that supports HTTP 1.0/1.1 protocols. LiteSpeed web server can serve as a transparent reverse proxy to accelerate and protect web servers and application servers. When communicating with backend web servers, LiteSpeed will always try to utilize persistent connections in order to achieve the highest performance.
  • A servlet engine is an application, like Apache Tomcat and Jetty, that implements Java servlets and Java Server Pages. LiteSpeed can communicate with servlet engines through AJPv1.3 (Apache JServ Protocol version 1.3). Servlet engine cannot be started by the web server and can be setup to run on a remote machine.
  • 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

New External App

Type

Type

Description

Specifies the type of external application. Application types are differentiated by the service they provide or the protocol they use to communicate with the server. Choose from

  • 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

Select from drop down list

Tips

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.