There are several web servers for Linux but other alternatives are always welcome. In this case, I will show you how to install OpenLiteSpeed on Ubuntu 20.04 Also, we will make it support PHP.
What is OpenLiteSpeed?
OpenLiteSpeed is an open source web server, released under the GPL license that guarantees access to the code. According to the official website of the project, OpenLiteSpeed combines speed, security, scalability, optimization and simplicity in one friendly open-source package.
On the other hand, it has quite peculiar characteristics that make it easy to access without losing robustness.
Another important aspect to emphasize is that this is the free version of LiteSpeed web server. Therefore, stability and robustness are guaranteed.
OpenLiteSpeed comes with a number of important features such as the following:
- It has enormous scalability. Thanks to an event driven architecture.
- It is able to understand Apache rewriting rules. Which makes if you have used this web server, the transition is easy.
- It allows to install WordPress, MariaDB and the server with a single click.
- It integrates strong security measures. This mitigates attacks and performance issues.
- Integrates Google’s web site acceleration system.
- Native SAPI for PHP allows external applications written in PHP to run up to 50% faster.
So, let us install it.
Install OpenLiteSpeed on Ubuntu 20.04
Unfortunately, OpenLiteSpeed is not in the official Ubuntu 20.04 repositories. However, this does not mean that it can be easily installed thanks to the repository that developers have for Debian-based distributions like Ubuntu 20.04
So, the first step is to add the OpenLiteSpeed repository.
:~$ wget -O - http://rpms.litespeedtech.com/debian/enable_lst_debian_repo.sh | sudo bash
Once the whole process is completed, you will be successfully added to the system’s repository list.
Now install the application by refreshing the APT cache and running the following command:
:~$ sudo apt update :~$ sudo apt install openlitespeed Reading package lists… Done Building dependency tree Reading state information… Done The following additional packages will be installed: aspell aspell-en dictionaries-common emacsen-common enchant hunspell-en-us libaspell15 libc-client2007e libenchant1c2a libhunspell-1.7-0 libjpeg-turbo8 libjpeg8 libxpm4 libzip5 lsphp73 lsphp73-common lsphp73-imap lsphp73-json lsphp73-mysql lsphp73-opcache mlock php-common php-readline php7.4-common php7.4-readline rcs Suggested packages: aspell-doc spellutils wordlist hunspell openoffice.org-hunspell | openoffice.org-core uw-mailutils libenchant-voikko php-pear php-user-cache The following NEW packages will be installed: aspell aspell-en dictionaries-common emacsen-common enchant hunspell-en-us libaspell15 libc-client2007e libenchant1c2a libhunspell-1.7-0 libjpeg-turbo8 libjpeg8 libxpm4 libzip5 lsphp73 lsphp73-common lsphp73-imap lsphp73-json lsphp73-mysql lsphp73-opcache mlock openlitespeed php-common php-readline php7.4-common php7.4-readline rcs 0 upgraded, 27 newly installed, 0 to remove and 46 not upgraded. Need to get 20.4 MB of archives. After this operation, 93.2 MB of additional disk space will be used. Do you want to continue? [Y/n]
Also, install the package that installs PHP 7.4 support for OpenLiteSpeed. We chose version 7.4 because it is updated and is the one that Ubuntu incorporates in its repositories.
:~$ sudo apt install lsphp74 Reading package lists… Done Building dependency tree Reading state information… Done The following additional packages will be installed: libonig5 libwebp6 lsphp74-common lsphp74-json lsphp74-opcache Suggested packages: php-pear php-user-cache The following NEW packages will be installed: libonig5 libwebp6 lsphp74 lsphp74-common lsphp74-json lsphp74-opcache 0 upgraded, 6 newly installed, 0 to remove and 46 not upgraded. Need to get 9272 kB of archives. After this operation, 46.6 MB of additional disk space will be used. Do you want to continue? [Y/n]
Now, enable PHP 7.4 support for OpenLiteSpeed.
:~$ sudo ln -sf /usr/local/lsws/lsphp74/bin/lsphp /usr/local/lsws/fcgi-bin/lsphp5
Now, you can start running OpenLiteSpeed.
:~$ sudo /usr/local/lsws/bin/lswsctrl start [OK] Send SIGUSR1 to 5745
One of the things I like most about OpenLiteSpeed is its powerful graphical interface. With it, you can manage the webserver in a very fast and comfortable way. This graphical interface works through port 7080 and requires a username and password.
So, to create the password and username, you have to execute the following command:
:~$ sudo /usr/local/lsws/admin/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]: 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!
Configuring OpenLiteSpeed on Ubuntu 20.04
After that, you can visit the OpenLiteSpeed web interface. Open your favorite web browser and go to
http://server-ip:8070 and you will see the following screen.
Type in your created credentials and then you will see the dashboard.
By default, the OpenLiteSpeed virtual host accepts connections on port
8088. It usually accepts requests on port
80, which is HTTP.
Changing this is quite easy. First, from the left link go to the Listeners section.
There you will see some basic information about the default Listener which as you can see, is listening for port
8088. Under the Action section, click on the magnifying glass icon to see all the data for it.
On this screen, you will see all the information about the default Listener. On the right side, you will see the edit icon. Click on it.
Now you can change whatever you want. In this case, we are coming through the port. Place the port
80 and save the changes by clicking on the diskette icon.
Now that the changes can be applied you have to do a graceful restart. Click on the OpenLiteSpeed icon and there you will see the button that does it.
Now you can go to
http://your-server and you will see the default OpenLiteSpeed page indicating that everything is fine.
Finally, it’s a good idea to check the PHP support. So, create a new PHP file in
/usr/local/lsws/Example/html/ which is Virtualhost’s default Document Root.
:~$ sudo nano /usr/local/lsws/Example/html/test.php <?php phpinfo(); ?>
Save the changes and close the file.
So, open it using the web browser
So, enjoy it.
n this post, we have met another quite popular web server as OpenLiteSpeed. In a market dominated by Apache and Nginx it’s always nice to have other alternatives for our projects.
Please share this post and join our Telegram channel.