Install and configure OpenLiteSpeed with WordPress and LSCache optimization

Intermediate 35 min Apr 27, 2026 119 views
Ubuntu 24.04 Debian 12 AlmaLinux 9 Rocky Linux 9

Set up OpenLiteSpeed web server with PHP 8.4, deploy WordPress with database integration, and enable LSCache plugin for maximum performance optimization.

Prerequisites

  • Root or sudo access
  • Fresh server installation
  • At least 2GB RAM
  • Domain name (optional)

What this solves

OpenLiteSpeed delivers high-performance WordPress hosting with built-in caching capabilities. This tutorial covers installing OpenLiteSpeed, configuring PHP 8.4 with LiteSpeed SAPI, setting up WordPress with MySQL, and enabling LSCache for optimal performance.

Step-by-step installation

Update system packages

Start by updating your package manager to ensure you get the latest versions.

sudo apt update && sudo apt upgrade -y
sudo dnf update -y

Install required dependencies

Install essential packages needed for OpenLiteSpeed compilation and operation.

sudo apt install -y wget curl gnupg2 software-properties-common lsb-release ca-certificates apt-transport-https
sudo dnf install -y wget curl gnupg2 epel-release

Add OpenLiteSpeed repository

Add the official OpenLiteSpeed repository to access the latest stable version.

wget -O - https://repo.litespeed.sh | sudo bash
sudo apt update
sudo rpm -Uvh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el8.noarch.rpm
sudo dnf update

Install OpenLiteSpeed

Install the OpenLiteSpeed web server package.

sudo apt install -y openlitespeed
sudo dnf install -y openlitespeed

Install PHP 8.4 with LiteSpeed SAPI

Install PHP 8.4 specifically compiled for LiteSpeed with essential extensions for WordPress.

sudo apt install -y lsphp84 lsphp84-common lsphp84-curl lsphp84-mysql lsphp84-opcache lsphp84-mbstring lsphp84-xml lsphp84-gd lsphp84-zip lsphp84-imagick
sudo dnf install -y lsphp84 lsphp84-common lsphp84-curl lsphp84-mysql lsphp84-opcache lsphp84-mbstring lsphp84-xml lsphp84-gd lsphp84-zip lsphp84-imagick

Install MySQL server

Install and secure MySQL database server for WordPress data storage.

sudo apt install -y mysql-server
sudo systemctl enable --now mysql
sudo mysql_secure_installation
sudo dnf install -y mysql-server
sudo systemctl enable --now mysqld
sudo mysql_secure_installation

Create WordPress database and user

Set up a dedicated MySQL database and user account for WordPress.

sudo mysql -u root -p
CREATE DATABASE wordpress_db;
CREATE USER 'wordpress_user'@'localhost' IDENTIFIED BY 'SecurePassword123!';
GRANT ALL PRIVILEGES ON wordpress_db.* TO 'wordpress_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Set admin password for OpenLiteSpeed

Set the administrator password for the OpenLiteSpeed web console.

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

Enter your desired username and password when prompted. Remember these credentials for accessing the web console.

Start and enable OpenLiteSpeed

Start the OpenLiteSpeed service and enable it to start automatically on boot.

sudo systemctl enable --now lsws
sudo systemctl status lsws

Configure firewall ports

Open the necessary ports for web traffic and OpenLiteSpeed admin panel.

sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw allow 7080/tcp
sudo ufw allow 8088/tcp
sudo ufw --force enable
sudo firewall-cmd --permanent --add-port=80/tcp
sudo firewall-cmd --permanent --add-port=443/tcp
sudo firewall-cmd --permanent --add-port=7080/tcp
sudo firewall-cmd --permanent --add-port=8088/tcp
sudo firewall-cmd --reload

Configure OpenLiteSpeed for WordPress

Access OpenLiteSpeed web console

Navigate to the OpenLiteSpeed administration interface to configure virtual hosts.

Open your web browser and visit https://your-server-ip:7080. Log in with the credentials you set earlier.

Configure PHP version

Set PHP 8.4 as the default scripting language in OpenLiteSpeed.

  1. Navigate to Script Handler tab
  2. Click the + button to add a new script handler
  3. Set the following values:
SettingValue
Suffixesphp
Script Handler TypeLiteSpeed SAPI
Commandlsphp84

Click Save and perform a Graceful Restart.

Create WordPress directory

Create the document root directory for your WordPress installation.

sudo mkdir -p /usr/local/lsws/wordpress
sudo chown -R nobody:nogroup /usr/local/lsws/wordpress
sudo chmod -R 755 /usr/local/lsws/wordpress

Configure virtual host

Set up a virtual host for WordPress in the OpenLiteSpeed web console.

  1. Navigate to Virtual Hosts+
  2. Configure the virtual host:
SettingValue
Virtual Host Namewordpress
Virtual Host Root/usr/local/lsws/wordpress/
Config File/usr/local/lsws/conf/vhosts/wordpress/vhconf.conf
Enable Scripts/ExtAppsYes

Click Save and navigate to the newly created virtual host.

Configure virtual host general settings

Set the document root and index files for the WordPress virtual host.

  1. Click on the wordpress virtual host
  2. Go to General tab
  3. Set these values:
SettingValue
Document Root/usr/local/lsws/wordpress/
Index Filesindex.php, index.html
Auto IndexNo

Set up listener and mapping

Configure the HTTP listener and map the virtual host.

  1. Navigate to ListenersDefault (*:8088)
  2. Go to Virtual Host Mappings tab
  3. Click + and add:
SettingValue
Virtual Hostwordpress
Domain*

Click Save and perform a Graceful Restart.

Install and configure WordPress

Download WordPress

Download the latest WordPress release and extract it to the document root.

cd /tmp
wget https://wordpress.org/latest.tar.gz
tar -xzf latest.tar.gz
sudo cp -R wordpress/* /usr/local/lsws/wordpress/
sudo chown -R nobody:nogroup /usr/local/lsws/wordpress
sudo chmod -R 755 /usr/local/lsws/wordpress

Configure WordPress database connection

Create and configure the WordPress configuration file with database credentials.

cd /usr/local/lsws/wordpress
sudo cp wp-config-sample.php wp-config.php
sudo chown nobody:nogroup wp-config.php
define('DB_NAME', 'wordpress_db');
define('DB_USER', 'wordpress_user');
define('DB_PASSWORD', 'SecurePassword123!');
define('DB_HOST', 'localhost');
define('DB_CHARSET', 'utf8mb4');
define('DB_COLLATE', '');

// Security keys - generate at https://api.wordpress.org/secret-key/1.1/salt/
define('AUTH_KEY', 'your-unique-auth-key');
define('SECURE_AUTH_KEY', 'your-unique-secure-auth-key');
define('LOGGED_IN_KEY', 'your-unique-logged-in-key');
define('NONCE_KEY', 'your-unique-nonce-key');
define('AUTH_SALT', 'your-unique-auth-salt');
define('SECURE_AUTH_SALT', 'your-unique-secure-auth-salt');
define('LOGGED_IN_SALT', 'your-unique-logged-in-salt');
define('NONCE_SALT', 'your-unique-nonce-salt');
Security Note: Generate unique security keys at https://api.wordpress.org/secret-key/1.1/salt/ and replace the placeholder values above.

Set correct file permissions

Configure WordPress file and directory permissions for security and functionality.

sudo find /usr/local/lsws/wordpress/ -type d -exec chmod 755 {} \;
sudo find /usr/local/lsws/wordpress/ -type f -exec chmod 644 {} \;
sudo chmod 600 /usr/local/lsws/wordpress/wp-config.php
sudo mkdir -p /usr/local/lsws/wordpress/wp-content/uploads
sudo chown -R nobody:nogroup /usr/local/lsws/wordpress/wp-content
sudo chmod -R 775 /usr/local/lsws/wordpress/wp-content
Never use chmod 777. It gives every user on the system full access to your files. Instead, fix ownership with chown and use minimal permissions as shown above.

Enable and configure LSCache

Enable cache module in OpenLiteSpeed

Activate the built-in cache module in OpenLiteSpeed web console.

  1. Navigate to Server ConfigurationModules
  2. Find cache in the module list
  3. Set the value to Yes
  4. Click Save and perform a Graceful Restart

Configure cache settings for virtual host

Set up cache configuration specifically for the WordPress virtual host.

  1. Navigate to Virtual Hostswordpress
  2. Go to Cache tab
  3. Configure these settings:
SettingValue
Enable CacheYes
Cache Root/usr/local/lsws/cachedata/wordpress/
Cache Expire Time (seconds)3600
Cache Max Object Size10000000

Click Save and perform a Graceful Restart.

Install LSCache WordPress plugin

Complete the WordPress installation and install the LSCache plugin.

  1. Visit http://your-server-ip:8088 in your browser
  2. Complete the WordPress installation wizard
  3. Log into WordPress admin panel
  4. Navigate to PluginsAdd New
  5. Search for "LiteSpeed Cache"
  6. Install and activate the plugin

Configure LSCache plugin settings

Optimize the LSCache plugin for maximum performance.

  1. Navigate to LiteSpeed CacheCache
  2. Enable these cache options:
SettingStatus
Enable CacheON
Cache Logged-in UsersON
Cache CommentersON
Cache REST APION
Cache Login PageON

Click Save Changes.

Configure purge settings

Set up automatic cache purging for content updates.

  1. Navigate to LiteSpeed CachePurge
  2. Enable these purge rules:
SettingStatus
Purge All On UpgradeON
Auto Purge Rules for Publish/UpdateON
Serve StaleON

Enable object cache

Activate object caching to improve database query performance.

  1. Navigate to LiteSpeed CacheObject
  2. Set Object Cache to ON
  3. Set Method to Redis (if available) or Memcached
  4. Click Save Changes

Optimize PHP settings

Configure PHP performance settings

Optimize PHP configuration for WordPress performance.

memory_limit = 512M
max_execution_time = 300
max_input_vars = 3000
upload_max_filesize = 64M
post_max_size = 64M

; OPcache settings
opcache.enable=1
opcache.enable_cli=1
opcache.memory_consumption=256
opcache.interned_strings_buffer=12
opcache.max_accelerated_files=60000
opcache.revalidate_freq=2
opcache.fast_shutdown=1

Restart services

Restart OpenLiteSpeed to apply the PHP configuration changes.

sudo systemctl restart lsws

Verify your setup

Test your OpenLiteSpeed and WordPress installation with these verification commands:

# Check OpenLiteSpeed status
sudo systemctl status lsws

Verify PHP version

/usr/local/lsws/lsphp84/bin/php --version

Test MySQL connection

sudo mysql -u wordpress_user -p -e "SELECT 1;"

Check cache directory permissions

ls -la /usr/local/lsws/cachedata/

Test web server response

curl -I http://localhost:8088

Check LSCache plugin status (if installed)

wp plugin status litespeed-cache --path=/usr/local/lsws/wordpress/

Visit http://your-server-ip:8088 to confirm WordPress is loading correctly. Check the LSCache plugin status in WordPress admin to ensure caching is active.

Common issues

Symptom Cause Fix
503 Service Unavailable PHP handler not configured Verify lsphp84 script handler in web console
WordPress database connection error Incorrect database credentials Check wp-config.php database settings
File upload errors Permission issues Set ownership to nobody:nogroup and correct permissions
Cache not working Cache module disabled Enable cache module in server configuration
High memory usage OPcache misconfigured Tune opcache settings in php.ini
Admin console inaccessible Firewall blocking port 7080 Open port 7080 in firewall configuration

Next steps

Running this in production?

Want this handled for you? Setting this up once is straightforward. Keeping it patched, monitored, backed up and performant across environments is the harder part. See how we run infrastructure like this for European teams.

Automated install script

Run this to automate the entire setup

Need help?

Don't want to manage this yourself?

We handle managed cloud infrastructure for businesses that depend on uptime. From initial setup to ongoing operations.