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.

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
| Item | Recommendation |
|---|---|
| Operating system | Ubuntu 24.04 LTS (PHP 8.3 and MariaDB in the default repositories) |
| Resources | 1 vCPU and 2 GB RAM is comfortable for a small site; more for WooCommerce or high traffic |
| Domain | An A record for the root domain and www pointing to the VPS IP |
| Access | SSH 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-imagickUbuntu 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.comStep 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 enableufw 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-runIf 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
- Open
https://example.comin your browser and choose a language. - Enter the database name
wordpress, userwpuser, your password and hostlocalhost. WordPress writeswp-config.phpfor you. - Set the site title and an admin username that is not
admin, with a strong password. - Log in at
/wp-admin, go to Settings, Permalinks and choose Post name.
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-fpmFor 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
| Problem | Likely cause | Fix |
|---|---|---|
| 502 Bad Gateway | PHP-FPM socket path wrong or service stopped | Check /run/php/ for the socket name and restart php8.3-fpm |
| Error establishing a database connection | Wrong credentials in wp-config.php | Re-check the database name, user and password |
| Permalinks return 404 | Missing try_files line | Add it to the location / block and reload Nginx |
| Updates ask for FTP details | Files not owned by www-data | Run chown on the site folder again |
| Upload fails for large files | PHP or Nginx limit | Raise 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.
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.


