How to install OpenLiteSpeed on Ubuntu
OpenLiteSpeed is a open source web server version of LiteSpeed Web Server Enterprise by LiteSpeed Technologies. Known for being lightweight, PageSpeed Optimization, Intelligent Cache Acceleration and more.
Getting Started
In this How to, we'll guide you step by step to install apps OpenLiteSpeed on your Ubuntu 18.04 machine.
NOTE
Successfully tested with WSL (Windows Subsystem for Linux) Ubuntu 18.04 LTS (19/07/2019)
Step 1: Update your system
$ sudo apt-get update && sudo apt-get upgrade
Step 2: Remove any HTTP web servers
Remove any HTTP web server installed on your system (apache,nginx)
$ dpkg -l | grep 'apache\|nginx'
Step 3: Install required dependencies
$ sudo apt-get install build-essential
$ sudo apt-get install rcs libpcre3-dev libexpat1-dev libssl-dev libgeoip-dev libudns-dev zlib1g-dev libxml2 libxml2-dev libpng-dev openssl
Step 4: Add LiteSpeedTech Repository
$ wget -O - http://rpms.litespeedtech.com/debian/enable_lst_debain_repo.sh | bash
$ sudo apt-get update
if bash Permission denied (else skip to next Step)
If you received permission denied flags while previous command failed to execute and received similar message blow:
bash: line 32: /etc/apt/sources.list.d/lst_debian_repo.list: Permission denied register LiteSpeed GPG key /etc/apt/trusted.gpg.d/lst_debian_repo.gpg: Permission denied /etc/apt/trusted.gpg.d/lst_repo.gpg: Permission denied update the repo
Solution: wget enable_lst_debain_repo.sh to your home directory
wget http://rpms.litespeedtech.com/debian/enable_lst_debain_repo.sh
Change permissions to
chmod -x enable_lst_debain_repo.sh
Execute bash (Same issue? sudo
on your own risk)
bash enable_lst_debain_repo.sh
Step 7: Install OpenLiteSpeed
The default directory is /usr/local/lsws
after installation
$ apt-get install openlitespeed
To start the server
$ /usr/local/lsws/bin/lswsctrl start
Navigate to http://ip-here:8088
in your browser. If OpenLiteSpeed logo and a text saying Congratulations, well you know what that means. To stop the server, run the above command and replace start
with stop
.
To access the WebAdmin console navigate to http://ip-here:7080
(Port can be changed) with default login credensional admin
: 123456
Step 8: Install PHP
OpenLiteSpeed does not come with PHP 7.2 included.
$ sudo apt-get install lsphp72 lsphp72-common lsphp72-curl lsphp72-dbg lsphp72-dev lsphp72-imap lsphp72-intl lsphp72-json lsphp72-ldap lsphp72-modules-source lsphp72-mysql lsphp72-opcache lsphp72-pgsql lsphp72-pspell lsphp72-pspell lsphp72-recode lsphp72-snmp lsphp72-sqlite3 lsphp72-sybase lsphp72-tidy
All avalible PHP versions can be found here or in your terminal:
$ apt-cache pkgnames lsphp
PHP will be located in /usr/local/lsws/lsphpXX
after version you installed.
Step 9: Firewall configurations (optional)
If a firewall is installed on the machine, ensure ports to be open:
- 80
- 443
- 8080
- 7080
For IPTABLE
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
For ufw
$ sudo ufw allow http
$ sudo ufw allow https
$ sudo ufw allow 8088/tcp
$ sudo ufw allow 7080/tcp
$ sudo ufw reload
Step 10: Configure port 80
OpenLiteSpeed default http port is 8080. In the WebAdmin console, go to Listeners under Listeners List locate adminListener and click on the Listeners Name to View.
Locate Address Settings and on its right hand side you will find the edit button. Change the fields to your needs. For sake of this guide, we will only change port 8080
to 80
. For the changes to take effect you need to do a Graceful restart by pressing the Green button next to LSWS PID.
Step 11: Configure PHP 7.2 as new handler
Navigate to Server Configuration then External App and locate LiteSpeed SAPI App and edit. Make the following changes from data below.
Field | New value |
---|---|
Name | lsphp72 |
Address | uds://tmp/lshttpd/lsphp72.sock |
Max Connections | 35 |
Environment | PHP_LSAPI_MAX_REQUESTS=500 PHP_LSAPI_CHILDREN=35 |
Command | $SERVER_ROOT/lsphp72/bin/lsphp |
Save and find Script Handler tab and locate LiteSpeed SAPI and edit. Change Handler Name to lsphp72
hit Save and do Graceful restart
Step 12: Cant access WebAdmin Console port problem
If you by mistake edit the port and/or cant access WebAdmin Console, stop the server and edit /usr/local/lsws/admin/conf/admin_config.conf
and change adress under listener adminListener.
Authors
- Mattias Ghodsian
Was this useful ?
Buy Me A Coffee