LiteSpeed is a high-performance web server optimized for speed, scalability, and efficient resource usage—making it ideal for hosting WordPress sites. This guide provides a streamlined walkthrough to install WordPress on a LiteSpeed server, covering everything from setting up the database and configuring wp-config.php
with secure salts to applying proper file permissions and securing your environment. With LiteSpeed’s built-in caching and Apache compatibility, you’ll ensure a fast, reliable, and secure WordPress deployment.
Table of Contents
Step 1: Navigate to Your Web Root
Ensure you’re in the correct directory where your site files will be stored. For example:
cd /usr/local/lsws/example.com/html
This is the document root for your domain configured in LiteSpeed.
Step 2: Generate Secure Random Strings
You’ll need strong passwords and keys. Generate secure values using:
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 10 | head -n 3
Use these as passwords or part of your wp-config.php
keys later.
Step 3: Create a MySQL Database and User
Log in to MySQL:
mysql -u root -p
Then run:
CREATE DATABASE example_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'example_user'@'localhost' IDENTIFIED BY 'StrongPass#123';
GRANT ALL PRIVILEGES ON example_db.* TO 'example_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;
💡 Replace
example_db
,example_user
, andStrongPass#123
with your own.
🧹 (Optional) Commands to Delete a Database or User
DROP DATABASE database_name;
DROP USER 'username'@'localhost';
DROP USER 'username'@'%';
FLUSH PRIVILEGES;
EXIT;
📏 Check MySQL Database Size
You can monitor DB usage with:
SELECT table_schema AS "Database",
ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS "Size (MB)"
FROM information_schema.tables
GROUP BY table_schema;
Step 4: Set Correct File Permissions
To avoid permission issues and ensure secure file access:
sudo chown -R nobody:nogroup /usr/local/lsws/example.com/html
Step 5: Download and Extract WordPress
Navigate to the root directory and fetch WordPress:
cd /
wget https://wordpress.org/latest.tar.gz
tar xzf latest.tar.gz
Move the extracted files to your web directory and prepare the config:
cp -r wordpress/* /usr/local/lsws/example.com/html/
cd /usr/local/lsws/example.com/html
mv wp-config-sample.php wp-config.php
Step 6: Generate and Add WordPress Secret Keys
Get fresh salts from WordPress API:
curl -s https://api.wordpress.org/secret-key/1.1/salt/
Copy the output and replace the existing define()
salt lines in wp-config.php
.
Example snippet:
define('AUTH_KEY', 'your-salt-here');
define('SECURE_AUTH_KEY', 'your-salt-here');
define('LOGGED_IN_KEY', 'your-salt-here');
define('NONCE_KEY', 'your-salt-here');
define('AUTH_SALT', 'your-salt-here');
define('SECURE_AUTH_SALT', 'your-salt-here');
define('LOGGED_IN_SALT', 'your-salt-here');
define('NONCE_SALT', 'your-salt-here');
Final Step: Complete Installation via Browser
Visit your domain (e.g., http://example.com
) and follow the WordPress installation wizard:
- Select your language.
- Enter DB name, username, and password.
- Set your site title, admin account, and email.