ThisCalculator

Everyday

VPS With OpenLiteSpeed and WordPress: Setup Guide

Updated · Standard formula, shown below

This guide walks you through getting a Virtual Private Server (VPS) running OpenLiteSpeed and WordPress, ready to serve your website. You’ll start with a bare Linux server and end with a fully configured WordPress site, including a web server, database, and SSL certificate. Before you begin, you need a VPS from any provider (with root SSH access) and a domain name pointed to its IP address.

What You’ll Need

  • A VPS with at least 1 GB RAM and 1 CPU core (2 GB RAM recommended).
  • Root or sudo access to the server via SSH.
  • A domain name with DNS A record pointing to your VPS IP.
  • An SSH client (like Terminal on macOS/Linux or PuTTY on Windows).

Step-by-Step

  1. Connect to your VPS via SSH. Open your terminal and run: ssh root@your_server_ip. If you use a non-root user, replace root with that username.
  2. Update the system. Run: apt update && apt upgrade -y (for Debian/Ubuntu) or yum update -y (for CentOS/RHEL). This ensures all existing packages are current.
  3. Install OpenLiteSpeed. The easiest method is using the official LiteSpeed repository. For Ubuntu/Debian, run:
    wget -O - https://repo.litespeed.sh | sudo bash
    sudo apt install openlitespeed -y

    For CentOS/RHEL, use:

    wget -O - https://repo.litespeed.sh | sudo bash
    sudo yum install openlitespeed -y
  4. Install MariaDB (MySQL). Run: sudo apt install mariadb-server -y (or sudo yum install mariadb-server -y). Start and enable it: sudo systemctl start mariadb && sudo systemctl enable mariadb.
  5. Secure the database. Run: sudo mysql_secure_installation. Follow the prompts: set a root password, remove anonymous users, disallow remote root login, remove test databases, and reload privileges.
  6. Install PHP and required extensions. OpenLiteSpeed ships with its own PHP binaries. To install PHP 8.x and common extensions, run:
    sudo apt install lsphp81 lsphp81-common lsphp81-mysql lsphp81-curl lsphp81-gd lsphp81-mbstring lsphp81-xml lsphp81-zip -y

    (Adjust the version number if a newer one is available. For CentOS, use yum instead of apt.)

  7. Set up the WordPress database. Log into MariaDB: sudo mysql -u root -p. Create a database and user:
    CREATE DATABASE wordpress;
    CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'strong_password_here';
    GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'localhost';
    FLUSH PRIVILEGES;
    EXIT;

    Replace strong_password_here with a secure password.

  8. Download WordPress. Navigate to the web root: cd /usr/local/lsws/. Download and extract:
    wget https://wordpress.org/latest.tar.gz
    tar -xzf latest.tar.gz
    mv wordpress/example.com

    Replace example.com with your actual domain. Set proper ownership: sudo chown -R www-data:www-data /usr/local/lsws/example.com.

  9. Configure OpenLiteSpeed for your domain. Access the WebAdmin console at http://your_server_ip:7080 (login with username admin and the password generated during installation – you can reset it with sudo /usr/local/lsws/admin/misc/admpass.sh). Create a new Virtual Host:
    • Go to Virtual Hosts → Add.
    • Set Name to your domain, and set the Virtual Host Root to /usr/local/lsws/example.com.
    • Under General, set the document root to $VH_ROOT.
    • Add a listener on port 80 (and 443 for SSL) that maps to this virtual host.
  10. Enable PHP for the virtual host. In the virtual host settings, go to General → Script Handler, and add a handler for lsphp with the command lsphp81 (or your installed version). This tells OpenLiteSpeed to process PHP files.
  11. Run the WordPress installer. Visit http://your_domain.com in a browser. Follow the on-screen steps: select your language, enter the database details (database name: wordpress, user: wpuser, password: the one you set), and the host as localhost. Then run the installation and set your admin username/password.
  12. Enable SSL (HTTPS). Install Certbot: sudo apt install certbot python3-certbot-apache -y (the Apache plugin works for OpenLiteSpeed as well). Obtain a certificate:
    sudo certbot certonly --webroot -w /usr/local/lsws/example.com -d example.com -d www.example.com

    Then, in OpenLiteSpeed WebAdmin, add a listener on port 443, set the SSL certificate and key paths (usually in /etc/letsencrypt/live/example.com/), and enable SSL.

  13. Set up automatic renewal. Add a cron job: crontab -e and add:
    0 3 * * * /usr/bin/certbot renew --quiet
  14. Optimize with LiteSpeed Cache. Install the LiteSpeed Cache plugin from the WordPress admin dashboard (Plugins → Add New → search “LiteSpeed Cache”). Activate it and follow the setup wizard. This enables caching and other performance features.

Common Mistakes

  • Incorrect file permissions – WordPress needs to be owned by the web server user (usually www-data), not root. If you get “Permission denied” errors, run chown -R www-data:www-data /usr/local/lsws/example.com.
  • Using the wrong PHP version – OpenLiteSpeed uses its own PHP binaries (like lsphp81). If you install system PHP, it won’t work unless you configure the script handler correctly.
  • Not opening port 80/443 in the firewall – Many VPS providers have a firewall enabled. Ensure ports 80, 443, and 7080 (for admin) are open. Use ufw allow 80,443,7080/tcp if using UFW.
  • Forgetting to point DNS – If you can’t access your site, check that your domain’s A record points to your VPS IP. It can take time to propagate.
  • Using a weak database password – Always use a strong, unique password for the database user.

Tips

  • Use a swap file – If your VPS has 1 GB RAM, create a 2 GB swap to avoid out-of-memory issues: fallocate -l 2G /swapfile && chmod 600 /swapfile && mkswap /swapfile && swapon /swapfile.
  • Enable caching – The LiteSpeed Cache plugin is essential for performance. It offers page caching, CSS/JS minification, and image optimization.
  • Set up a firewall – Even if your provider has one, configure UFW or firewalld to only allow necessary ports.
  • Regular backups – Use a plugin like UpdraftPlus or schedule cron jobs to back up your database and files.
  • Monitor logs – Check /usr/local/lsws/logs/error.log and access.log for issues. This helps debug errors quickly.

Troubleshooting

  • Site not loading – Check if the OpenLiteSpeed service is running: sudo systemctl status lsws. If not, start it with sudo systemctl start lsws. Also, verify your firewall rules.
  • PHP files download instead of executing – This means the script handler is not configured. In WebAdmin, go to your virtual host → Script Handler, and add lsphp with the correct binary.
  • Database connection errors during WordPress install – Double-check your database name, user, and password. Ensure the user has privileges: GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'localhost'; and FLUSH PRIVILEGES;.
  • SSL certificate not working – Make sure port 443 is open, and the certificate paths are correct in the listener settings. Test with sudo certbot certificates to see if the cert exists.
  • 500 Internal Server Error – Check the error log at /usr/local/lsws/logs/error.log. Common causes: incorrect file permissions or a PHP fatal error. Fix permissions or enable error display in PHP settings.
  • Cannot access WebAdmin – Ensure port 7080 is open and you’re using the correct URL. Reset the admin password with sudo /usr/local/lsws/admin/misc/admpass.sh.

Frequently Asked Questions

Is OpenLiteSpeed free?

Yes, OpenLiteSpeed is an open-source web server, free to use. It offers high performance and is compatible with many Apache features.

Can I use OpenLiteSpeed with existing WordPress sites?

Yes, you can migrate an existing WordPress site by copying your files and database, then updating the wp-config.php with new database details. The LiteSpeed Cache plugin can help with caching.

How do I update OpenLiteSpeed?

Use the package manager: sudo apt update && sudo apt upgrade openlitespeed (or yum). You can also check the official website for the latest version.

What is the default admin password for OpenLiteSpeed?

During installation, a random password is generated and shown. If you missed it, reset it with sudo /usr/local/lsws/admin/misc/admpass.sh.

Can I install WordPress without SSH?

No, this guide requires SSH access to set up the server. Some providers offer one-click installers, but they may not use OpenLiteSpeed.

How do I enable HTTP/2 or HTTP/3?

OpenLiteSpeed supports HTTP/2 and HTTP/3 by default. Ensure your listener has the appropriate ports (443 for HTTP/2, 443 UDP for HTTP/3) and SSL configured.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.