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.
In this How to, we'll guide you step by step to install apps OpenLiteSpeed on your Ubuntu 18.04 machine.
Successfully tested with WSL (Windows Subsystem for Linux) Ubuntu 18.04 LTS (19/07/2019)
$ sudo apt-get update && sudo apt-get upgrade
Remove any HTTP web server installed on your system (apache,nginx)
$ dpkg -l | grep 'apache\|nginx'
$ 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
$ wget -O - http://rpms.litespeedtech.com/debian/enable_lst_debain_repo.sh | bash
$ sudo apt-get update
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
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
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.
If a firewall is installed on the machine, ensure ports to be open:
- 80
- 443
- 8080
- 7080
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
$ sudo ufw allow http
$ sudo ufw allow https
$ sudo ufw allow 8088/tcp
$ sudo ufw allow 7080/tcp
$ sudo ufw reload
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.
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
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.
- Mattias Ghodsian
Buy Me A Coffee
Install MariaDB ("MySQL")
or
Start MySQL
If you encounter issues starting MariaDB try a rollback
or
if this still doesn't work please purge MariaDB and MySQL and try again
MySQL Secure Installation
Configure MySQL Socket address (If needed)
By default the MySQL socket should be located
/var/run/mysqld/mysqld.sock
, to fix this we need to define the correct path in php.ini file.Hit CTRL+W to search and type
pdo_mysql.default_socket
and change the path like soHit CTRL+O to save and CTRL + X to edit
Error establishing a database connection
If you have problems connecting to MySQL from your site, change the
plugin
and set the password with commandFor production sites its recommended to create another user with access to only its table