Installing OpenLiteSpeed on CentOS Stream 9: The Ultimate ‘Weapon’ for WordPress

CentOS tutorial - IT technology blog
CentOS tutorial - IT technology blog

When Apache and Nginx “Run Out of Breath”: Why Choose OpenLiteSpeed?

When managing e-commerce infrastructure, my biggest fear is a server “hanging” right when customers are checking out. Previously, the Apache + PHP-FPM combo was the “standard” choice due to its stability. However, when traffic hits 2,000 – 3,000 CCU (Concurrent Users), Apache consumes massive amounts of RAM, causing extremely slow system responses.

Nginx was a lifesaver for speed but lacks .htaccess support. Configuring Rewrite Rules for WordPress on Nginx is quite a hassle; even a missing semicolon can take down the entire site.

OpenLiteSpeed (OLS) solves both problems. It uses an event-driven architecture like Nginx but understands Apache rules. In real-world tests, OLS can handle 3-5 times more requests than Apache while consuming 60% less RAM.

Real-world Comparison: OpenLiteSpeed vs. Nginx vs. Apache

Here is a quick comparison based on my hands-on experience with 2 vCPU/4GB RAM servers:

  • Apache: Excellent compatibility, but prone to bottlenecks at 500-700 requests/second.
  • Nginx: Great load handling, super-fast static file processing, but PHP configuration (PHP-FPM) is somewhat cumbersome.
  • OpenLiteSpeed: Fastest PHP processing speed thanks to LSAPI. Specifically, the built-in LSCache significantly reduces database load.

If your goal is to optimize TTFB (Time to First Byte) to under 200ms without upgrading hardware, OLS is the unrivaled choice.

Deployment Process for OpenLiteSpeed on CentOS Stream 9

This is the “checklist” I usually use to set up servers for clients. The requirement is a fresh install of CentOS Stream 9.

Step 1: Configure the Official Repository

The default CentOS app store doesn’t have OLS. You need to load the repo from LiteSpeed’s official publisher to install the latest version.

sudo rpm -Uvh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el9.noarch.rpm

After running the above command, clean the cache so the system recognizes the new packages correctly:

sudo dnf clean all

Step 2: Install OpenLiteSpeed and PHP 8.3

OLS uses a specifically optimized version of PHP called LSPHP. Currently, PHP 8.3 offers about 10% faster script processing compared to 8.2. I recommend using this version for new projects.

sudo dnf install openlitespeed lsphp83 lsphp83-common lsphp83-mysqlnd lsphp83-gd lsphp83-process lsphp83-mbstring lsphp83-xml lsphp83-opcache lsphp83-bcmath lsphp83-pdo

The system will automatically pull the necessary dependencies. This process usually takes about 1-2 minutes depending on the server’s network speed.

Step 3: Initialize the Web Admin Account

Instead of editing dry configuration files, OLS allows you to manage everything via a web interface on port 7080. Run the following script to set the admin username and password:

sudo /usr/local/lsws/admin/misc/admpass.sh

Pro tip: Set a highly complex password because this management port is often a target for brute-force attacks.

Step 4: Open Firewall Ports

CentOS Stream 9 manages security strictly via firewalld. If you don’t open the ports, you won’t be able to access the web. You need to open ports: 80 (HTTP), 443 (HTTPS), 7080 (Admin), and 8088 (OLS test port).

sudo firewall-cmd --permanent --add-port={80/tcp,443/tcp,7080/tcp,8088/tcp}
sudo firewall-cmd --reload

Step 5: Check Service Status

Enable OpenLiteSpeed to start automatically whenever the server reboots:

sudo systemctl enable --now lsws
sudo systemctl status lsws

If you see the status active (running), access http://YOUR_IP:8088. If the LiteSpeed welcome page appears, everything is ready.

Fine-tuning OpenLiteSpeed via Web Admin

Log in to https://YOUR_IP:7080 to begin deeper configuration. Note: The browser will show an SSL error because we haven’t installed a real certificate yet; just click “Proceed” or “Continue”.

Switching Port 8088 to Port 80

To run the website officially on your domain, you must move it to the standard port 80:

  1. Find the Listeners menu in the left column.
  2. Click the View icon on the Default line.
  3. Click Edit and change 8088 to 80.
  4. Click Save. Don’t forget to click the Graceful Restart button (red icon) to apply changes.

Set LSPHP 8.3 as Default

To ensure the server uses the PHP 8.3 version you just installed, go to Server Config -> External App. Here, edit the lsphp path (Command) to: $SERVER_ROOT/lsphp83/bin/lsphp.

The Real Power of LSCache

The biggest selling point of OLS is LSCache. In one project where I migrated data from Apache to OLS, simply enabling LSCache helped reduce TTFB from 1.2s to 0.15s.

Unlike typical static cache plugins, LSCache has an extremely smart “Purge” capability. When you update a post, it only clears the cache for that specific post without affecting other pages. This helps the server maintain peak performance even if the website has thousands of articles.

Important Note: OLS supports .htaccess but does not automatically reload when you edit the file. Every time you install a new plugin or change Permalink settings in WordPress, you need to go to the OLS Admin and select Graceful Restart.

Conclusion

Installing OpenLiteSpeed on CentOS Stream 9 is the optimal solution for running WordPress at high speeds with low costs. I hope this guide helps you feel more confident in building your server. If you encounter a “403 Forbidden” error or cannot connect to the database, double-check your SELinux configuration or the html folder permissions!

Share: