How to install OpenLiteSpeed and PHP 7.3 / 7.2 / 7.1 / 7.0 from LiteSpeed repositories on Debian 9 (stretch) / 8 (jessie)

We are going to install OpenLiteSpeed on Debian 9 (stretch) / 8 (jessie) server from LiteSpeed repository. OpenLiteSpeed is the open source edition of LiteSpeed Web Server Enterprise. Both servers are actively developed and maintained by the same team, and are held to the same high-quality coding standard. OpenLiteSpeed contains all of the essential features found in LiteSpeed Enterprise, and represents our commitment to support the Open Source community. It is recommended to use CentOS 7 / 6 for OpenLiteSpeed for stability.

Some Features:

  • Event-Driven Architecture. Fewer processes, less overhead, and enormous scalability. Keep your existing hardware.
  • Upgrade from Apache. OpenLiteSpeed is mod_rewrite compatible, so you can continue to use your current rewrite rules.
  • Friendly Admin Interfaces. OLS comes with a built-in WebAdmin GUI. Control panel support is available with CyberPanel.
  • Built for Speed and Security. Features Anti-DDoS connection and bandwidth throttling, ModSecurity v3 integration, and more.
  • Intelligent Cache Acceleration. Built-in full-page cache module is highly-customizable and efficient for an exceptional user experience.
  • PageSpeed Optimization. Automatically implement Google’s PageSpeed optimization system with the mod_pagespeed module.
  • PHP LiteSpeed SAPI. Native SAPI for PHP allows external applications written in PHP to run up to 50% faster.
  • One-Click Installation. Install OpenLiteSpeed, MariaDB and WordPress on various operating systems with just one click.
  • WordPress Acceleration. Experience a measurable performance boost with OpenLiteSpeed and LSCache for WordPress.

Step 1: Install repository

Debian 9 (stretch):

echo "deb http://rpms.litespeedtech.com/debian/ stretch main" > /etc/apt/sources.list.d/lst_debian_repo.list

Add a GPG key to the apt sources keyring:

gpg --keyserver keys.gnupg.net --recv-key 011AA62DEDA1F085
gpg -a --export 011AA62DEDA1F085 | apt-key add -

Debian 8 (jessie):

echo "deb http://rpms.litespeedtech.com/debian/ jessie main" > /etc/apt/sources.list.d/lst_debian_repo.list

Add a GPG key to the apt sources keyring:

gpg --keyserver keys.gnupg.net --recv-key 011AA62DEDA1F085
gpg -a --export 011AA62DEDA1F085 | apt-key add -

CentOS 7:

yum install epel-release
rpm -ivh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el7.noarch.rpm 

CentOS 6:

yum install epel-release
rpm -ivh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el6.noarch.rpm

Step 2: Ensure you have removed any other HTTP web server (apache,nginx)

You can check this by executing this command:

dpkg -l | grep 'apache\|nginx'

Install latest/recent version of OpenLiteSpeed from yum:

apt-get install openlitespeed

Step 3: Install PHP from LiteSpeed repository

Additional dependencies should be installed before install PHP

yum -y install gcc make gcc-c++ cpp kernel-headers.x86_64 libxml2-devel openssl-devel bzip2-devel libjpeg-devel libpng-devel freetype-devel openldap-devel postgresql-devel aspell-devel net-snmp-devel libxslt-devel libc-client-devel libicu-devel gmp-devel curl-devel libmcrypt libmcrypt-devel pcre-devel sqlite-devel db4-devel enchant-devel libXpm-devel mysql-devel readline-devel libedit-devel recode-devel libtidy-devel libtool-ltdl-devel  

To install PHP 7.3:

apt-get install lsphp73 lsphp73 lsphp73-common lsphp73-dbg lsphp73-dev lsphp73-imap lsphp73-intl lsphp73-json lsphp73-ldap lsphp73-opcache lsphp73-pgsql lsphp73-pspell lsphp73-recode lsphp73-snmp lsphp73-tidy -y

Then we need to symlink the lib folder

ln -s /usr/local/lsws/lsphp73/lib64 /usr/local/lsws/lsphp73/lib

To install PHP 7.2:

apt-get install lsphp72 lsphp72-common lsphp72-dbg lsphp72-dev lsphp72-imap lsphp72-intl lsphp72-json lsphp72-ldap lsphp72-opcache lsphp72-pgsql lsphp72-pspell lsphp72-recode -y

Then we need to symlink the lib folder

ln -s /usr/local/lsws/lsphp72/lib64 /usr/local/lsws/lsphp72/lib

To install PHP 7.1:

apt-get install lsphp71 lsphp71-common lsphp71-dbg lsphp71-dev lsphp71-imap lsphp71-intl lsphp71-json lsphp71-ldap lsphp71-opcache lsphp71-pgsql lsphp71-pspell lsphp71-recode -y

Then we need to symlink the lib folder

ln -s /usr/local/lsws/lsphp71/lib64 /usr/local/lsws/lsphp71/lib

To install PHP 7.0:

apt-get install lsphp70 lsphp70-common lsphp70-dbg lsphp70-dev lsphp70-imap lsphp70-intl lsphp70-json lsphp70-ldap lsphp70-opcache lsphp70-pgsql lsphp70-pspell lsphp70-recode -y

Then we need to symlink the lib folder

ln -s /usr/local/lsws/lsphp70/lib64 /usr/local/lsws/lsphp70/lib

Step 4: Firewall configurations

If you have firewall installed ensure this ports are open:

  • 80
  • 443
  • 8080
  • 7080

For iptables use this commands to open the ports:

iptables -I INPUT -p tcp --dport 80 -j ACCEPT
iptables -I INPUT -p tcp --dport 443 -j ACCEPT
iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
iptables -I INPUT -p tcp --dport 7080 -j ACCEPT

Step 5: Start OpenLiteSpeed and login to dashboard

To start OpenLiteSpeed:

systemctl start lsws

To stop and restart:

systemctl stop lsws
systemctl restart lsws

Now we need to reset the OpenLiteSpeed admin password :

cd /usr/local/lsws/admin/misc
./admpass.sh

When prompting for username leave it blank eg.:

[root@server3 ~]# cd /usr/local/lsws/admin/misc
[root@server3 misc]# ./admpass.sh

Please specify the user name of administrator.
This is the user name required to login the administration Web interface.

User name [admin]:

Please specify the administrator's password.
This is the password required to login the administration Web interface.

Password: 
Retype password: 
Administrator's username/password is updated successfully!

Step 6: Login to OpenLiteSpeed admin panel

https://10.135.87.168:7080

replace 10.135.87.168 with your server ip.

Step 7: Configure port 80 (http) and 443 (https)

The default http port for OpenLiteSpeed is 8080, it’s used to receive the client requests. In this step, we will change the port to 80 from the OpenLiteSpeed management GUI.

On the left side, go to the “Listeners” section to see the listeners configuration. You will see the default listener with port 8080. Click “view” zoom icon to see details configuration. Now click “Edit”.

IP Address: ANY
Port 80

Change the port to 80 and save the configuration.

For SSL 443 follow this official documentation: https://openlitespeed.org/mediawiki/index.php/Help:SSL_Setup
To apply changes, please perform a graceful restart.

Leave a Reply

Your email address will not be published. Required fields are marked *