This article shows how to install litespeed in centos.LSAPI is used within the context of the LiteSpeed Web Server (LSWS) to handle requests for web applications efficiently. To use LSAPI, you typically follow these steps:
1. How to Install LiteSpeed Web Server (LSWS)
First, you need to install the LiteSpeed Web Server on your server. LSWS comes in different versions, including an open-source version (OpenLiteSpeed) and commercial versions. Here’s how you can install OpenLiteSpeed:
- For CentOS/RHEL:
sudo yum install epel-release
sudo rpm -Uvh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el7.noarch.rpm
sudo yum install openlitespeed
For Ubuntu/Debian:
wget -O – http://rpms.litespeedtech.com/debian/enable_lst_debain_repo.sh | sudo bash
sudo apt-get update
sudo apt-get install openlitespeed
2. Configure the Web Server
After installation, you need to configure LSWS to use LSAPI for your applications.
For PHP applications:
- Install LSAPI for PHP:
sudo apt-get install lsphp74 lsphp74-common lsphp74-mysql lsphp74-opcache
- Set Up PHP with LSAPI: Edit the LiteSpeed configuration to point to the PHP LSAPI binary. Typically, this can be done in the LiteSpeed WebAdmin console (usually accessible at
http://<your-server-ip>:7080).- Navigate to
Server Configuration->External App. - Add a new external app and choose
LiteSpeed SAPI App. - Configure the necessary details, such as:
- Name:
lsphp - Address:
uds://tmp/lshttpd/lsphp.sock - Command:
/usr/local/lsws/lsphp74/bin/lsphp
- Name:
- Navigate to
- Create a Script Handler:
- Navigate to
Server Configuration->Script Handler. - Add a new script handler with:
- Suffix:
php - Handler Type:
LiteSpeed SAPI - Handler Name:
lsphp
- Suffix:
- Navigate to
For other applications (e.g., Ruby, Python):
- Install the necessary runtime and LSAPI module: Follow the specific instructions for your language to install the LSAPI module.
- Configure the external application: Similar to PHP, you’ll need to configure an external application in the LiteSpeed WebAdmin console, pointing to the appropriate LSAPI binary for your language.
3. Restart LiteSpeed Server
After making the necessary configuration changes, restart the LiteSpeed server to apply them:
sudo systemctl restart lsws
