Mist Network
Kanalı takip et
Destek

How to Install WordPress on a VPS: Step-by-Step Guide (Ubuntu 24.04)

Running WordPress on your own VPS gives you full control and dedicated resources. This guide takes you from a fresh Ubuntu 24.04 server to a secure HTTPS site with Nginx, PHP 8.3 and MariaDB in about half an hour.

Updated: 5 min read
How to install WordPress on a VPS — Nginx, PHP and MariaDB on Ubuntu 24.04 with free SSL

To install WordPress on a VPS, you set up a web server (Nginx), PHP and a database (MariaDB), create a database and user for WordPress, download WordPress into the site folder, point your domain to the server and issue a free SSL certificate. On a fresh Ubuntu 24.04 server the whole process takes about 30 minutes, and you end up with a site that uses the server's resources only for you.

This guide walks through every command. You need a VPS with root or sudo access, a registered domain and basic comfort with a terminal. Replace example.com with your own domain throughout.

Why run WordPress on a VPS?

Shared hosting is easier, but a VPS gives you things shared plans cannot:

  • Dedicated resources. CPU and RAM are reserved for your server, so a busy neighbour does not slow your site.
  • Full control. Choose the PHP version, tune caching, install Redis or any tool you need.
  • Room to grow. Host several sites, staging copies or other apps on the same server.

The trade-off is responsibility: you handle updates, security and backups. If you would rather not, managed Plesk hosting is the simpler path; we compare the options in VPS vs shared hosting.

What you need before you start

ItemRecommendation
Operating systemUbuntu 24.04 LTS (PHP 8.3 and MariaDB in the default repositories)
Resources1 vCPU and 2 GB RAM is comfortable for a small site; more for WooCommerce or high traffic
DomainAn A record for the root domain and www pointing to the VPS IP
AccessSSH as root or a sudo user, ideally with key-based login

Set up DNS first so it has time to update while you install the software. Our guide on how to point a domain to a VPS shows the exact records.

Step 1: install Nginx, PHP and MariaDB

Log in over SSH, update the system and install the LEMP stack together with the PHP extensions WordPress uses for images, multilingual text, XML and updates:

sudo apt update && sudo apt upgrade -y
sudo apt install -y nginx mariadb-server php-fpm php-mysql php-curl php-gd \
  php-intl php-mbstring php-xml php-zip php-imagick

Ubuntu 24.04 installs PHP 8.3 with PHP-FPM, which Nginx talks to through a Unix socket. Both Nginx and MariaDB start automatically and are enabled at boot.

Step 2: create the database and user

Run the MariaDB security script (set a root password or keep socket login, remove anonymous users and the test database), then open the MariaDB shell and create a dedicated database and user:

sudo mariadb-secure-installation
sudo mariadb
CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'use-a-long-random-password';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Use a long random password and store it in a password manager. A separate user limited to one database means a compromised site cannot read your other databases.

Step 3: download WordPress

Always download WordPress from the official site, then move it into the web root and give ownership to the web server user:

cd /tmp
curl -O https://wordpress.org/latest.tar.gz
tar xzf latest.tar.gz
sudo mv wordpress /var/www/example.com
sudo chown -R www-data:www-data /var/www/example.com

Step 4: configure Nginx for WordPress

Create /etc/nginx/sites-available/example.com with the following server block. The try_files line makes pretty permalinks work, and the last block hides files such as .htaccess or a .git folder:

server {
    listen 80;
    server_name example.com www.example.com;
    root /var/www/example.com;
    index index.php;
    client_max_body_size 64M;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php8.3-fpm.sock;
    }

    location ~ /\.(ht|git) {
        deny all;
    }
}

Enable the site, remove the default page, test the configuration and open the firewall for SSH, HTTP and HTTPS:

sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/
sudo rm -f /etc/nginx/sites-enabled/default
sudo nginx -t && sudo systemctl reload nginx
sudo ufw allow OpenSSH
sudo ufw allow 'Nginx Full'
sudo ufw enable
Watch out: always allow OpenSSH before running ufw enable, or you can lock yourself out of the server.

Step 5: add a free SSL certificate

Once your domain resolves to the VPS, Certbot can obtain a Let's Encrypt certificate and update the Nginx config to redirect HTTP to HTTPS automatically. Certificates renew on their own; the dry run confirms renewal works:

sudo apt install -y certbot python3-certbot-nginx
sudo certbot --nginx -d example.com -d www.example.com
sudo certbot renew --dry-run

If Certbot fails, the A record usually does not point to the server yet. Check with dig +short example.com and wait for the old TTL to expire.

Step 6: run the WordPress installer

  1. Open https://example.com in your browser and choose a language.
  2. Enter the database name wordpress, user wpuser, your password and host localhost. WordPress writes wp-config.php for you.
  3. Set the site title and an admin username that is not admin, with a strong password.
  4. Log in at /wp-admin, go to Settings, Permalinks and choose Post name.
Key takeaway: WordPress itself is the easy part. What keeps a VPS site healthy is what you do next: updates, backups and a hardened server.

Step 7: tune PHP limits and performance

The default upload size is small for themes and media. Raise the limits in the PHP-FPM configuration and restart the service:

# /etc/php/8.3/fpm/php.ini
upload_max_filesize = 64M
post_max_size = 64M
memory_limit = 256M
max_execution_time = 120

sudo systemctl restart php8.3-fpm

For speed, PHP's OPcache is enabled by default on Ubuntu. Add a page cache plugin, compress and resize images before upload, and consider Redis with an object cache plugin once traffic grows.

Secure and maintain your WordPress VPS

  • Keep everything updated: Ubuntu packages, WordPress core, themes and plugins. Enable unattended security upgrades.
  • Harden SSH: key-based login, disable password login and root login. Our VPS security checklist covers the full list.
  • Back up files and database on a schedule, and store copies off the server.
  • Install fewer plugins: each one is code you have to trust and update.
  • Limit login attempts with a plugin or Fail2Ban to slow down brute-force attacks.

Common problems and fixes

ProblemLikely causeFix
502 Bad GatewayPHP-FPM socket path wrong or service stoppedCheck /run/php/ for the socket name and restart php8.3-fpm
Error establishing a database connectionWrong credentials in wp-config.phpRe-check the database name, user and password
Permalinks return 404Missing try_files lineAdd it to the location / block and reload Nginx
Updates ask for FTP detailsFiles not owned by www-dataRun chown on the site folder again
Upload fails for large filesPHP or Nginx limitRaise upload_max_filesize and client_max_body_size

WordPress on a mistREG VPS

mistREG VPS plans run on NVMe SSD and AMD EPYC hardware and are set up automatically within about 60 seconds of payment, with Ubuntu 24.04 among the available images. You can pay with crypto or card and register the domain in the same account, with free WHOIS privacy and DNS. The VPS Start plan (1 vCPU, 2 GB RAM, 15 GB SSD) is enough for a typical small WordPress site.

< 60sautomatic setup
NVMeSSD storage
7 daysrefund window

Prefer not to manage a server? Plesk hosting with LiteSpeed runs WordPress without the command line. Otherwise, create an account, compare the VPS plans and check the FAQ, or ask on Telegram at @mistnetwork.

Frequently asked questions

How much RAM does WordPress need on a VPS?
A small WordPress site runs comfortably on 1 vCPU and 2 GB of RAM with Nginx, PHP-FPM and MariaDB. WooCommerce stores, many plugins or high traffic benefit from 4 GB or more.
Should I use Nginx or Apache for WordPress?
Both work well. Nginx uses less memory under load and is a common choice on a VPS; Apache reads .htaccess files, which some plugins expect. With Nginx you put rewrite rules in the server block instead.
Is WordPress on a VPS faster than shared hosting?
It can be, because the CPU and RAM are reserved for you and you control caching. Speed still depends on your theme, plugins and caching setup, so a poorly tuned VPS can be slower than good shared hosting.
Can I host multiple WordPress sites on one VPS?
Yes. Create a separate database, user, folder and Nginx server block for each site, and issue a certificate for each domain. Keep an eye on RAM as you add sites.
Do I need a control panel to run WordPress on a VPS?
No. The steps in this guide use only the command line. A panel such as Plesk makes management easier but uses extra resources and may require a licence.

Related articles

Latest articles

All articles
Mist NetworkMist Network