October 2, 2022 . 2 MIN READ
Before starting, ensure you have:
An Ubuntu 22.04 server with a non-root sudo user.
A Domain Name pointed to your server’s IP.
SSL Certificates (obtained via Certbot) located in /etc/letsencrypt/live/your_domain/.
OpenLiteSpeed maintains its own repository. To install it, you must add their software source to your system.
Update and Upgrade:
Bash
sudo apt update && sudo apt upgrade -y
Add OpenLiteSpeed Repository:
Bash
sudo wget -O - https://repo.litespeed.sh | sudo bash
Install the Server:
Bash
sudo apt update
sudo apt install openlitespeed
Verify Service:
Bash
sudo systemctl status lsws
OpenLiteSpeed uses specific ports for its admin panel and example site. You need to open these in ufw.
7080: Admin Panel
8088: Example Website
80/443: Standard HTTP/HTTPS
Bash
sudo ufw allow 7080,80,443,8088/tcp
MariaDB handles the database layer of your stack.
Install MariaDB:
Bash
sudo apt install mariadb-server
Secure the Installation: Run sudo mysql_secure_installation.
Switch to unix_socket authentication: Y
Set root password: Y
Remove anonymous users: Y
Disallow root login remotely: Y
Remove test database: Y
Reload privilege tables: Y
OpenLiteSpeed uses LSPHP to process dynamic content faster via the LSAPI.
Search for versions: sudo apt-cache search lsphp
Install PHP 8.1:
Bash
sudo apt install lsphp81 lsphp81-common lsphp81-mysql
To manage the server via the web interface, set your administrative credentials first.
Set Admin Password:
Bash
sudo /usr/local/lsws/admin/misc/admpass.sh
Access the Panel: Navigate to http://your_server_ip:7080.
Set PHP Version: * Go to Server Configuration > External App.
Edit the lsphp app and change the Command to lsphp81/bin/lsphp.
Perform a Graceful Restart (top right icon).
Virtual Hosts allow you to host specific domains.
Create Virtual Host: In the Admin Panel, add a new Virtual Host.
Name: MyWebsite
Root: $SERVER_ROOT/MyWebsite/html/
Config File: conf/vhosts/MyWebsite/vhconf.conf (Click “click to create” if prompted).
Map Listener:
Navigate to Listeners > Default.
Under Virtual Host Mappings, add your domain and map it to MyWebsite.
Configure SSL:
Change the Listener port to 443 and set Secure to Yes.
Under the SSL tab, provide the paths to your Let’s Encrypt keys:
Private Key: /etc/letsencrypt/live/your_domain/privkey.pem
Certificate: /etc/letsencrypt/live/your_domain/fullchain.pem
Chained Certificate: Yes
Enable HTTP/3 (QUIC): OpenLiteSpeed supports HTTP/3 out of the box. Simply allow UDP traffic on the firewall:
Bash
sudo ufw allow 443/udp
Your LOMP stack is now operational. You have a Linux environment running OpenLiteSpeed with a secured MariaDB database and optimized PHP 8.1. You can now begin uploading your WordPress or Laravel files to the Virtual Host root directory.
Next Step: Would you like me to generate a technical diagram showing how the LiteSpeed SAPI (LSAPI) handles PHP requests compared to standard FastCGI?
Reference:
https://www.digitalocean.com/community/tutorials/how-to-install-linux-openlitespeed-mariadb-php-lomp-stack-on-ubuntu-22-04