WORDPRESS
Jun 23, 2026

How to Install WordPress on a VPS (Step-by-Step)

8 min read
Author
CloudStick Team
Server Infrastructure
Share this article
How to Install WordPress on a VPS
CloudStick
WordPress on a VPS
step-by-step

Prerequisites

You need a VPS running Ubuntu 24.04 LTS with at least 1GB RAM, a domain name with its A record pointed to your server's IP address, and SSH access as root or a sudo user. DNS propagation takes 5–30 minutes; point your domain before starting so SSL certificate issuance works by the end of this guide.

PREREQUISITE

Domain A record must resolve to your VPS IP before running certbot. Check propagation with: dig +short yourdomain.com @8.8.8.8

Install the LEMP Stack

WordPress runs on Linux, Nginx, MySQL, and PHP — the LEMP stack. Ubuntu 24.04's package manager ships all four. PHP 8.3 is the current stable release and the version WordPress 6.5+ is optimized for. Install everything in one command:

sudo apt update && sudo apt upgrade -y
sudo apt install -y nginx mysql-server \
php8.3-fpm php8.3-mysql php8.3-xml php8.3-curl \
php8.3-gd php8.3-mbstring php8.3-zip php8.3-imagick \
php8.3-intl php8.3-bcmath unzip wget certbot \
python3-certbot-nginx
# Enable services to start at boot
sudo systemctl enable nginx mysql php8.3-fpm

Create the MySQL Database

WordPress needs a dedicated database and user — never connect WordPress using the MySQL root account. First, secure the MySQL installation, then create the database:

# Secure MySQL (set root password, remove test DB)
sudo mysql_secure_installation
# Connect as root
sudo mysql -u root -p
-- Inside MySQL shell:
CREATE DATABASE wordpress CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'StrongPassHere!';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Download and Configure WordPress

Always download WordPress directly from wordpress.org — never from third-party mirrors. Place it in /var/www/yourdomain.com and set the web server user as owner so Nginx can serve files and WordPress can write uploads:

cd /tmp && wget https://wordpress.org/latest.tar.gz
tar -xzf latest.tar.gz
sudo mkdir -p /var/www/yourdomain.com
sudo cp -r wordpress/* /var/www/yourdomain.com/
sudo chown -R www-data:www-data /var/www/yourdomain.com
sudo chmod -R 755 /var/www/yourdomain.com
# Create wp-config.php from sample
cd /var/www/yourdomain.com
sudo cp wp-config-sample.php wp-config.php
sudo sed -i "s/database_name_here/wordpress/" wp-config.php
sudo sed -i "s/username_here/wpuser/" wp-config.php
sudo sed -i "s/password_here/StrongPassHere!/" wp-config.php

Configure Nginx for WordPress

Create an Nginx server block for your WordPress site. This configuration handles PHP via FastCGI, sets correct file permissions, and blocks direct PHP execution in the uploads directory:

# /etc/nginx/sites-available/yourdomain.com
server {
listen 80;
server_name yourdomain.com www.yourdomain.com;
root /var/www/yourdomain.com;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location /wp-content/uploads {
location ~ \.php$ { deny all; }
}
}
sudo ln -s /etc/nginx/sites-available/yourdomain.com \
/etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx

Run the Installer and Enable SSL

With Nginx configured, get your free Let's Encrypt SSL certificate before opening the WordPress installer. Certbot modifies your Nginx config to redirect HTTP to HTTPS automatically:

sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com

Now visit https://yourdomain.com in a browser. The WordPress five-minute installer will load. Enter your site title, admin username, a strong password, and email. WordPress is installed. Set permalinks to "Post name" under Settings → Permalinks for clean URLs, then run sudo systemctl reload nginx to apply the rewrite rules.

TIP

After the installer, add authentication keys to wp-config.php by generating fresh salts at https://api.wordpress.org/secret-key/1.1/salt/ — replace the placeholder key block. These keys invalidate all existing sessions and are unique per installation.

The CloudStick Alternative: One Click

Every step above — LEMP install, database creation, file permissions, Nginx configuration, SSL certificate, and WordPress setup — happens in a single click in CloudStick's WordPress Manager. Connect your VPS to CloudStick, click "Install WordPress," enter your domain and admin credentials, and the dashboard handles the rest in under two minutes.

CloudStick also applies server hardening (UFW firewall, Fail2ban, SSH key auth) automatically at server connection time — steps this guide doesn't cover but that are essential for production. The manual steps above teach you how it works. CloudStick is how you do it at scale without repeating them for every new site or server.

Leave a comment
Full Name
Email Address
Message
Contents

We use cookies to improve your experience

CloudStick uses cookies to personalise content, analyse traffic and keep you signed in. Cookie Policy · Terms of Service

Manage cookies