Setting up an external application
LiteSpeed Web Server does not handle dynamic content with its own processes. Instead, it sends the requests out to external applications that have been set up to handle different kinds of dynamic content. This allows LSWS to more efficiently handle multiple requests and connections.
Go into the WebAdmin console
To set up external applications, first go to the External App tab of the WebAdmin console. Both the server- and virtual host-level settings have an External App tab. External applications set at the server level can be used by all virtual hosts. External applications set at the virtual host level are only available to that virtual host.
Types of External Application
External 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. (Perl)
- FastCGI Authorizer: a FastCGI application with an Authorizer role
- Servlet Engine: a servlet engine with an AJPv13 connector, such as Tomcat. (Java)
- 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. (PHP, Ruby, and Python)
- 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
Tip(s): Most applications will use either LSAPI or FastCGI protocol. PHP, Ruby, and Python can also be set up to run using FastCGI, but they run faster using LSAPI.
Choose an SAPI
The first thing you will set is the interface by which the server communicates with the external application. LiteSpeed Web Server works with a number of protocols — FastCGI, Servlet Engine, HTTP, etc. — but it runs fastest when external applications are built for LiteSpeed Server API (LSAPI). LSAPI has currently been developed for PHP, Ruby, and Python. Perl applications can be run with FastCGI. Java is run using AJPv13 (and you will have to install a separate servlet engine, such as Apache Tomcat, to run the application).
External apps can be started by web server or manually
External applications can be split into two types: Those that are started by the web server and those that have to be started manually. FastCGI and LSAPI applications running on the same machine as the web server can be started by the web server on demand. These applications are called “local external applications”. Applications that are not started by the web server are referred to as “remote external applications”, even when they are running on the same machine. (A servlet engine has to be started manually whether it runs on the same machine or not.) While the server starting external applications itself is more convenient, putting external applications on remote machines can allow for more scalability. This option is explored in the LSPHP Command Line Mode wiki.
After selecting the SAPI to use, you must specify a name, address, and maximum number of connections for the external application. For local external applications, you also need to specify the Command, Back Log, Instances, and Environment settings.
Script and context handlers
Setting up the values in the External App tab is not the end, though. External applications have to be configured as either a script handler or a context handler. These settings are how the web server knows which content to send to which external application.
Script handlers differentiate content based on the file's suffix (and the coressponding MIME type). Setting up an external application as a script handler (in the Script Handler tab at either the server or virtual host level) will cause the server to send certain types of files to that external application.
Context handlers can only be configured at the virtual host level (Configuration > Virtual Hosts > your virtual host > Context). When configured as a context handler, an external application will be used for content based on its location, not its file type. The web server will send content to the external application as long as the request's URL matches the URI specified in the context settings.