OpenLiteSpeed is a high performance and lightweight HTTP server developed by LiteSpeed Technologies. OpenLiteSpeed is cross-platform (GNU/Linux, FreeBSD, MacOS) and can be integrated with applications developed in PHP, Ruby, Perl and Java.
OpenLiteSpeed is free to download, use, distribute and modify under the GPLv3 license.
Main features
- Event-driven architecture.
- Compatible with Apache’s mod_rewrite module.
- Native Web Control Panel that allows you to manage the server from a web interface.
- Protection against DDOS attack.
- ModSecurity V3 integration.
- Native cache system.
- Native SAPI for PHP that allows applications to run up to 50% faster.
- Cache plugin for WordPress.
Related Posts
- How to install Let’s Encrypt SSL in Debian?
- How to install and configure NGINX as reverse proxy
- How to install NGINX on NetBSD?
- How to install NGINX on Alpine Linux?
- How to Compile PHP 8.0 in Debian 10?
- How to install PHP 7.4 in Ubuntu 20.04?
- How to install Apache on Ubuntu 20.04?
- How to install Apache on Ubuntu 20.04?
Add the repo
LiteSpeed Technologies, the company that leads the development of OpenLiteSpeed, provides repo for CentOS, Debian and Ubuntu which facilitate the installation process. Select the distro in which we want to install OpenLiteSpeed, in this case Debian, then we execute the command:
$ sudo wget -O - http://rpms.litespeedtech.com/debian/enable_lst_debian_repo.sh | sudo bash
Install
$ sudo apt-get install openlitespeed
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
aspell aspell-en dictionaries-common emacsen-common enchant-2 hunspell-en-us libaspell15 libc-client2007e libenchant-2-2 libhunspell-1.7-0 libonig5 libsodium23 libzip4 lsphp74
lsphp74-common lsphp74-imap lsphp74-json lsphp74-mysql lsphp74-opcache mlock php-common php-readline php7.4-common php7.4-readline psmisc rcs
Suggested packages:
aspell-doc spellutils hunspell openoffice.org-hunspell | openoffice.org-core uw-mailutils libenchant-2-voikko php-pear php-user-cache
The following NEW packages will be installed:
aspell aspell-en dictionaries-common emacsen-common enchant-2 hunspell-en-us libaspell15 libc-client2007e libenchant-2-2 libhunspell-1.7-0 libonig5 libsodium23 libzip4 lsphp74
lsphp74-common lsphp74-imap lsphp74-json lsphp74-mysql lsphp74-opcache mlock openlitespeed php-common php-readline php7.4-common php7.4-readline psmisc rcs
0 upgraded, 27 newly installed, 0 to remove and 6 not upgraded.
Need to get 21.5 MB of archives.
After this operation, 95.8 MB of additional disk space will be used.
With the above command we install the web server and PHP dependencies (OpenLiteSpeed control panel depends on PHP 7.4).
One of the advantages of OpenLiteSpeed is that it allows you to have more than one version of PHP installed, for example if you want to install PHP-81 run the command:
$ sudo apt-get install lsphp81 lsphp81-common lsphp81-curl lsphp81-mysql lsphp81-opcache lsphp81-imap lsphp81-opcache
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
libcurl4
Suggested packages:
php-pear php-user-cache
The following NEW packages will be installed:
libcurl4 lsphp81 lsphp81-common lsphp81-curl lsphp81-imap lsphp81-mysql lsphp81-opcache
0 upgraded, 7 newly installed, 0 to remove and 6 not upgraded.
Need to get 10.3 MB of archives.
After this operation, 52.6 MB of additional disk space will be used.
Do you want to continue? [Y/n]
All files related to OpenLiteSpeed (binaries, modules, configuration, sites) are located under the /usr/local/lsws dir.
$ tree -d -L 1 /usr/local/lsws/
/usr/local/lsws/
├── Example
├── add-ons
├── admin
├── autoupdate
├── backup
├── bin
├── cachedata
├── cgid
├── conf
├── docs
├── fcgi-bin
├── gdata
├── lib
├── logs
├── lsphp74
├── lsrecaptcha
├── modules
├── php
├── phpbuild
├── share
└── tmp
Manage the lsws process
lsws is the process through which we can start, stop and restart the server using systemd.
Check status
We can check if the server is running with the following command:
sudo systemctl status lsws
● lsws.service - LSB: lshttpd
Loaded: loaded (/etc/init.d/lsws; generated)
Active: active (running) since Thu 2023-06-01 22:45:02 UTC; 14min ago
Docs: man:systemd-sysv-generator(8)
Process: 10915 ExecStart=/etc/init.d/lsws start (code=exited, status=0/SUCCESS)
Tasks: 4 (limit: 510)
Memory: 15.7M
CPU: 850ms
CGroup: /system.slice/lsws.service
├─10943 openlitespeed (lshttpd - main)
├─10954 openlitespeed (lscgid)
├─10986 openlitespeed (lshttpd - #01)
└─10987 openlitespeed (lshttpd - #02)
Jun 01 22:45:00 bullseye systemd[1]: Starting LSB: lshttpd...
Jun 01 22:45:02 bullseye systemd[1]: Started LSB: lshttpd.
The above command confirms that server is running OK.
Start
If the previous command had shown us the following information (note the Active: inactive):
● lsws.service - LSB: lshttpd
Loaded: loaded (/etc/init.d/lsws; generated)
Active: inactive (dead) since Thu 2023-06-01 23:00:52 UTC; 57s ago
Docs: man:systemd-sysv-generator(8)
Process: 10915 ExecStart=/etc/init.d/lsws start (code=exited, status=0/SUCCESS)
Process: 11685 ExecStop=/etc/init.d/lsws stop (code=exited, status=0/SUCCESS)
CPU: 923ms
Then we can start the server with:
$ sudo systemctl start lsws
To start automatically with the Operating System execute:
$ sudo systemctl enable lsws
lsws.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable lsws
Restart
To apply any modification done on the configuration file, you must restart the server with the following command:
$ sudo systemctl restart lsws
Note that this step is not necessary if you manage the server from your control panel which offers a web interface for server administration.
Reload configuration
It is preferable to use the following command to refresh the configuration as the service will reload without losing connections.
$ sudo systemctl reload lsws
Note that this step is not necessary if you manage the server from your control panel which offers a web interface for server administration.
Stop
$ sudo systemctl stop lsws
Welcome page
By default OpenLiteSpeed receives requests on port 8088, this behavior can be changed in the control panel, so if we put http://IP:8088 in our browser we will see a page similar to the one shown in the image:
Control Panel
The control panel is available through the IP of the server where you installed OpenLiteSpeed and on port 7080, so put https://IP:7080 in your browser.
You can get the admin credentials by running the command:
$ cat /usr/local/lsws/adminpasswd
You can reset the crendentials using the following command:
$ sudo /usr/local/lsws/admin/misc/admpass.sh
Now you can access to the Control Panel.