How to Install WordPress on a VPS: A Practical Setup Guide
Running WordPress on your own VPS gives you control over PHP, the database, the web server, and caching. That flexibility helps with WooCommerce, custom plugins, and projects that outgrow shared hosting. It also makes the site owner responsible for patches, security configuration, monitoring, and backups. This guide outlines a sensible installation path on Ubuntu or Debian.
Check Requirements Before Starting
Use a supported Linux release and verify the current WordPress requirements at WordPress.org. Modern PHP, a supported MySQL or MariaDB version, and HTTPS are important. A busy e-commerce store may benefit from NVMe VPS plans, whereas a small editorial site may not need the most expensive storage tier.
Connect over SSH, update packages, and use a named administrator. Configure the firewall for required services. Keep the database port private unless an explicit architecture demands remote access.
Step 1: Install the Application Stack
For a Debian-family system, install Nginx, MariaDB, PHP-FPM, and the required extensions:
sudo apt update
sudo apt install nginx mariadb-server php-fpm php-mysql php-curl php-xml php-mbstring php-zip unzip
Open MariaDB using sudo mariadb, then create a database and a dedicated user. Replace the example password with a long random secret before running the SQL:
CREATE DATABASE wordpress CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'wp_site'@'localhost' IDENTIFIED BY 'CHANGE_TO_LONG_RANDOM_PASSWORD';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wp_site'@'localhost';
Download WordPress from its official source, place the files in the site directory, and configure wp-config.php with database credentials and fresh authentication keys.

Step 2: Configure the Web Server and TLS
Set the hostname, document root, and PHP handler in the Nginx virtual-host configuration. The PHP-FPM socket path depends on the installed PHP version; inspect /run/php/ rather than copying a path from an unrelated tutorial. Validate the configuration with sudo nginx -t. Once DNS resolves to the VPS, install a TLS certificate and test HTTPS.
Step 3: Secure and Maintain the Installation
- Update WordPress core, themes, plugins, and system packages.
- Run PHP with appropriate service permissions, never as root.
- Back up site files and the database to storage outside the VPS, and practice restoration.
- Monitor error logs, disk usage, PHP workers, and database pressure.
A small blog may run well on SSD VPS plans. When demand grows, compare other VPS plans plans using actual memory, CPU, and database measurements.
Installing WordPress is more than uploading its files. A dependable deployment includes a supported software stack, secure access, HTTPS, backups, and routine operations from day one.
WordPress Installation Questions
Is phpMyAdmin required?
No. You can create and maintain databases using command-line clients and dedicated management tools. If a team needs phpMyAdmin, restrict its network exposure and protect authentication. Leaving a database administration interface publicly reachable without appropriate controls adds unnecessary risk.
Why does Nginx return 502 Bad Gateway after installation?
Common causes include a stopped PHP-FPM service, an incorrect PHP socket path, exhausted worker capacity, or memory pressure. Inspect the relevant system service, /run/php/, and the Nginx and PHP logs. Avoid simply increasing worker counts without understanding per-process memory consumption.
What belongs in WordPress backups?
Include the database, user-uploaded media, configuration, and any custom code that cannot be restored from source control. Choose backup frequency based on how much recent content or order data you can afford to lose. Test restoring the complete application on a separate environment.