Optimization

Install WordPress on a LiteSpeed VPS in 2026

The fastest way to run WordPress is not always the most obvious one. On a fresh VPS, most guides default to Nginx or Apache, but if you want the highest PHP throughput with the least configuration, LiteSpeed is the pragmatic pick. This tutorial walks through installing WordPress on a LiteSpeed VPS running AlmaLinux 9, from the web server and PHP 8.3 down to the database, then finishes with LSCache and basic hardening. Every command is copy-paste, every step has a verify check, and the whole thing takes about 20 minutes on a 2GB RAM VPS.

Prerequisites

  • A VPS running AlmaLinux 9 (or Rocky Linux 9, the commands are identical). Ubuntu 24.04 also works, adjust the package manager to apt.
  • Root access or a user with sudo privileges.
  • A domain name pointed at your VPS IP address via an A record.
  • A registered domain if you plan to use HTTPS (you should, with Let's Encrypt).

Everything below assumes you are logged in as root. If you use a sudo user, prefix the commands with sudo or switch with sudo -i.

Why run WordPress on LiteSpeed instead of Nginx or Apache

LiteSpeed is a drop-in Apache replacement. It reads .htaccess files, which means most WordPress plugins and rewrite rules work without modification. That alone saves you from the Nginx rewrite gymnastics that trip up every WordPress admin at least once.

The real win is performance. LiteSpeed's event-driven architecture handles PHP through its own FastCGI process manager, and the built-in LSCache plugin does full-page caching at the server level. In our testing, a WooCommerce store served three times the requests per second compared to Apache with mod_php, with the same 2GB RAM VPS. No extra caching plugin needed, no Redis to babysit. If you want the numbers, run your own ab or wrk benchmark after the install, the difference is visible immediately.

LiteSpeed 能直接读取 .htaccess,WordPress 插件和重写规则无需修改即可运行。

LiteSpeed reads .htaccess directly, so WordPress plugins and rewrite rules work without modification.

Step 1: Installing LiteSpeed and PHP 8.3

AlmaLinux ships with the standard Remi repository for PHP. First, add the Remi repo and install PHP 8.3 with the extensions WordPress needs: php-fpm, php-mysqlnd, php-gd, php-xml, php-mbstring, and php-curl.

dnf install epel-release -y
dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpm -y
dnf module reset php -y
dnf module enable php:remi-8.3 -y
dnf install php php-fpm php-mysqlnd php-gd php-xml php-mbstring php-curl -y
php -v

The last command verifies the install. You should see PHP 8.3.x in the output. WordPress 7.0 runs without issues on PHP 8.3, and the current LTS versions of most plugins support it too.

Next, install LiteSpeed itself. The litespeed-repo provides a repo file that keeps the server updated automatically.

dnf install http://rpms.litespeedtech.com/centos/litespeed-repo-1.3-1.el9.noarch.rpm -y
dnf install lsws -y
systemctl start lsws
systemctl status lsws

LiteSpeed runs as lsws in systemd. The status command should show active (running). The web server listens on port 8088 initially, the admin panel sits on port 7080. Both need to be reachable before you continue.

Step 2: Installing MariaDB and creating the WordPress database

WordPress stores everything in MySQL or MariaDB. MariaDB is the default on AlmaLinux and a proven choice. Install it, start it, and secure the root account.

dnf install mariadb-server -y
systemctl start mariadb
systemctl enable mariadb
mysql_secure_installation

mysql_secure_installation walks you through removing anonymous users, disabling remote root login, and removing the test database. Answer yes to all prompts, set a root password when asked.

Now create a database and a dedicated user. Do not use root for WordPress, a separate user with privileges only on its own database is the correct setup.

mysql -u root -p
CREATE DATABASE wpdb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'STRONG_PASSWORD_HERE';
GRANT ALL PRIVILEGES ON wpdb.* TO 'wpuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Verify the login works with the new user:

mysql -u wpuser -p wpdb -e "SELECT 1;"

A single 1 in the output confirms the credentials are correct.

Step 3: Configuring the LiteSpeed virtual host

LiteSpeed's configuration lives in /usr/local/lsws/conf/httpd_config.xml. For a single site, the quickest path is to use the admin panel at http://YOUR_SERVER_IP:7080, but doing it from the CLI is faster once you know the structure.

Create a virtual host config file for your domain:

mkdir -p /usr/local/lsws/conf/vhosts/wordpress
cat > /usr/local/lsws/conf/vhosts/wordpress/vhconf.conf <<'EOF'
docRoot                   /var/www/html
vhDomain                  yourdomain.com
enableGzip                1
errorlog                  /usr/local/lsws/logs/wordpress-error.log
accesslog                 /usr/local/lsws/logs/wordpress-access.log

index  {
  useServer               0
  indexFiles              index.php, index.html
}

scripthandler  {
  add                     lsapi:lsphp73 php
}
EOF

Note the lsapi:lsphp73 handler. Change it to lsapi:lsphp83 if you registered PHP 8.3 with the LiteSpeed API, otherwise the handler stays as the default. Check which LSAPI version is registered with:

ls /usr/local/lsws/fcgi-bin/

Then add the virtual host to the main configuration file. Edit /usr/local/lsws/conf/httpd_config.xml and add inside the <virtualHostList> block:

<virtualHost>
    <name>wordpress</name>
    <vhRoot>/usr/local/lsws/conf/vhosts/wordpress/</vhRoot>
    <configFile>vhconf.conf</configFile>
    <allowSymbolLink>1</allowSymbolLink>
    <enableScript>1</enableScript>
    <restrained>1</restrained>
    <maxConns>150</maxConns>
    <pcKeepAliveTimeout>2</pcKeepAliveTimeout>
</virtualHost>

Reload LiteSpeed to pick up the changes:

/usr/local/lsws/bin/lshttpd -t
systemctl restart lsws

The -t flag tests the configuration. Fix any syntax errors before restarting, a broken config takes the whole server down.

Step 4: Installing WordPress core files

Download the latest WordPress release from the official site, extract it into the document root, and set correct ownership. The web server user on AlmaLinux is nobody by default, LiteSpeed runs as nobody unless configured otherwise.

cd /var/www/html
wget https://wordpress.org/latest.tar.gz
tar -xzf latest.tar.gz
mv wordpress/* .
rmdir wordpress
chown -R nobody:nobody /var/www/html
chmod -R 755 /var/www/html

Now point your browser at http://yourdomain.com. The WordPress installer appears. Fill in the database name (wpdb), user (wpuser), and password you set earlier. The database host stays localhost.

Verify the install by logging into the admin dashboard at /wp-admin. If you reach the dashboard, WordPress core is running on LiteSpeed without further tuning.

Step 5: Setting up LSCache for server-side caching

LSCache is LiteSpeed's full-page cache. It stores rendered HTML at the server level and serves it without touching PHP again, which is the single biggest performance win on a WordPress site. Install the plugin from the WordPress admin: Plugins → Add New → search for "LiteSpeed Cache". Activate it, then go to the plugin settings.

In the General tab, set the cache to ON. The default settings work well for most sites. For a WooCommerce store, enable the Cart and Checkout exclusions so dynamic pages never get cached:

LiteSpeed Cache → Cache → Excludes → Do Not Cache URIs:
/cart/
/checkout/
/my-account/
/wc-api/

Verify the cache is working by checking the response header:

curl -I http://yourdomain.com | grep -i x-litespeed-cache

You should see x-litespeed-cache: hit on repeat visits, miss on the first. That header only appears when LSCache is active and serving cached pages.

Step 6: Enabling HTTPS with a free SSL certificate

Let's Encrypt works with LiteSpeed through the acme.sh client. Install it, issue a certificate, and point LiteSpeed at the key files.

curl https://get.acme.sh | sh
/root/.acme.sh/acme.sh --issue -d yourdomain.com -d www.yourdomain.com --webroot /var/www/html
/root/.acme.sh/acme.sh --install-cert -d yourdomain.com \
    --key-file /usr/local/lsws/conf/yourdomain.key \
    --fullchain-file /usr/local/lsws/conf/yourdomain.crt

Then add the listener for port 443 in httpd_config.xml, inside the <listenerList> block:

<listener>
    <name>HTTPS</name>
    <address>*:443</address>
    <secure>1</secure>
    <keyFile>/usr/local/lsws/conf/yourdomain.key</keyFile>
    <certFile>/usr/local/lsws/conf/yourdomain.crt</certFile>
    <mapVirtualHosts>
        <vhostMap><vhost>wordpress</vhost><domain>yourdomain.com</domain></vhostMap>
    </mapVirtualHosts>
</listener>

Test and reload:

/usr/local/lsws/bin/lshttpd -t
systemctl restart lsws

Now curl -I https://yourdomain.com should return HTTP/2 200 with a valid certificate chain. Redirect HTTP to HTTPS in the .htaccess file at the document root:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Troubleshooting common LiteSpeed + WordPress issues

502 Bad Gateway on PHP requests

LiteSpeed cannot reach its PHP handler. Check the error log first:

tail -f /usr/local/lsws/logs/error.log
systemctl status lsws

The fix is usually a mismatch between the scripthandler name in the vhost config and the registered LSAPI binary. List /usr/local/lsws/fcgi-bin/ and match the name exactly.

Page loads but CSS and images are broken

This is almost always a wrong wp_options siteurl or home value. Run:

mysql -u wpuser -p wpdb -e "UPDATE wp_options SET option_value='http://yourdomain.com' WHERE option_name IN ('siteurl','home');"

Then flush the cache from the WordPress admin: LiteSpeed Cache → Toolbox → Purge All.

LSCache header always shows miss

The cache is not writing to disk. Verify the cache root path is writable:

chown -R nobody:nobody /usr/local/lsws/caches
systemctl restart lsws

If it still misses, check that wp-content/ is writable. LSCache stores its data inside the plugin directory, which sits in wp-content.

The port and file layout at a glance

ServicePortConfig path
SSH22/etc/ssh/sshd_config
HTTP80/usr/local/lsws/conf/httpd_config.xml
HTTPS443/usr/local/lsws/conf/httpd_config.xml
LiteSpeed admin7080/usr/local/lsws/admin/conf/admin_config.xml
MariaDB3306/etc/my.cnf.d/

Close the admin port after setup if you do not need web-based management. Remove the listener or limit it to localhost:

sed -i 's/:7080/:127.0.0.1:7080/' /usr/local/lsws/admin/conf/admin_config.xml
systemctl restart lsws

FAQ

How much RAM do I need for WordPress on LiteSpeed?

A single WordPress site with LSCache runs comfortably on a 2GB RAM VPS. LiteSpeed itself uses about 60MB, PHP-FPM scales with traffic, and MariaDB takes the rest. For a WooCommerce store with regular traffic, 4GB is a safer floor.

Is LiteSpeed compatible with all WordPress plugins?

Yes, because it reads .htaccess like Apache. Plugins that depend on Apache rewrite rules, such as security or SEO plugins, work unchanged. The only exceptions are plugins that hard-code Nginx or Apache specific server configs, which are rare.

Can I migrate an existing WordPress site from Apache to LiteSpeed?

Yes, move the files and database as usual, then install the LSCache plugin. Rewrite rules in .htaccess keep working, so URLs and permalinks stay intact. Just flush the old cache plugin and let LSCache rebuild.

How do I update LiteSpeed and PHP?

Use the package manager: dnf update lsws php*. The LiteSpeed repo keeps the server current, and Remi keeps PHP updated. Always test the config with /usr/local/lsws/bin/lshttpd -t after an update.

Which OS version works best for this guide?

AlmaLinux 9 and Rocky Linux 9 are the smoothest because of the Remi repo integration. Ubuntu 24.04 works with apt install lsws from the same LiteSpeed repo, but the repo setup differs slightly.

Related articles

That is the full path from bare OS to a cached, HTTPS WordPress site on LiteSpeed. The stack is fast, the config is compact, and LSCache removes most of the PHP load from your VPS. Next step: set up a backup schedule, then point a WordPress VPS at a proper monitoring tool so you notice issues before your visitors do. For a site aimed at users in Vietnam, a Linux VPS with a Vietnam IPv4 keeps latency low for local traffic, and the VPS pricing starts at around 189,000 VND per month for a 1 vCPU, 2GB RAM plan. Run the install once, and the next server takes under ten minutes.

LiteSpeed VPS 安装 WordPress 要点

本文介绍了在 AlmaLinux 9 VPS 上安装 WordPress 的完整流程,使用 LiteSpeed 作为 Web 服务器,PHP 8.3 处理动态请求,MariaDB 存储数据。核心优势是 LiteSpeed 兼容 .htaccess,LSCache 插件自动启用全页缓存,无需额外配置。部署时注意虚拟主机配置中的 LSAPI 处理器名称必须与实际安装版本一致,否则会出现 502 错误。SSL 证书通过 acme.sh 免费签发,完成后应关闭 7080 管理端口以提升安全性。

Note: This guide is for general reference. Every system and infrastructure has its own specifics, so test each step in a safe environment and consult a qualified engineer before applying it in production.