// hosting
Running WordPress on a VPS: when and how
When a VPS makes sense for WordPress instead of shared or managed hosting, the criteria that matter, and a clear walkthrough of the LEMP stack you need to run a site yourself.
Not sure how big your server should be? Try the free VPS size calculator →
Running WordPress on a VPS gives you full control of the stack - but it also hands you the responsibility of running a server. For some sites that trade is well worth it; for others, shared or managed WordPress hosting is the smarter call. This guide covers when a VPS makes sense and how to set one up, so you can decide with eyes open rather than follow a trend.
When a VPS makes sense for WordPress
WordPress runs happily on cheap shared hosting for small sites, and managed WordPress hosting removes the server work entirely. A VPS sits in between: dedicated resources and full root access, in exchange for doing the sysadmin yourself. Move to a VPS when:
- Your shared host throttles you or you hit CPU/process limits during traffic peaks.
- You run a heavier site - WooCommerce, a membership platform, or lots of plugins - that needs guaranteed RAM and CPU.
- You want control over the PHP version, web server config, caching layer, or to host several sites on one machine.
- You need a specific stack or tuning (object cache, custom Nginx rules, your own TLS setup) the shared host won't allow.
When a VPS is the wrong choice
Be honest about the trade-off. A VPS means you patch the OS, secure SSH, configure the web server, manage PHP, and own backups. If that's not work you want to do - or you'd be doing it badly - a managed WordPress host that handles updates, security and backups is usually the better value, even at a higher sticker price. A small brochure site rarely justifies the upkeep of a self-run server.
What a VPS changes for WordPress security
In security terms, a VPS is an isolation boundary: your WordPress runs in a virtual machine with its own OS, its own users and its own IP, kept apart from the other customers on the physical server by the hypervisor. Compared with shared hosting, that changes three things:
- Neighbours stop being a direct risk. On shared hosting, separation between accounts depends on how the host set it up (separate PHP users, CageFS or similar). On a VPS, another customer does not share your filesystem or your processes.
- The IP is yours alone. On shared hosting, if another site on the box sends spam, the shared IP can land on a blocklist and your WooCommerce or contact-form emails stop arriving. On a VPS the IP's reputation depends on you.
- You control the server's defences. A firewall (ufw or nftables), fail2ban against brute force on
wp-login.phpandxmlrpc.php, one PHP-FPM pool with its own user per site so an infected site cannot write into the others, and the PHP version you choose.
What a VPS does not fix: most WordPress holes are inside WordPress. Patchstack logged 11,334 new vulnerabilities in the WordPress ecosystem in 2025, 91% in plugins and 9% in themes, with only 6 low-priority ones in core (State of WordPress Security in 2026). A vulnerable plugin is exploited the same way on a VPS as on shared hosting. And on an unmanaged VPS, OS updates, SSH and backups become your job: a neglected VPS is less safe than good managed hosting.
| Risk | Shared hosting | VPS |
|---|---|---|
| Another customer on the server compromised | Depends on the host's isolation | Separated by the hypervisor |
| IP blocklisted because of a neighbour | Possible (shared IP) | No, dedicated IP |
| Brute force on wp-login.php | Whatever the host filters | You: fail2ban, Nginx rate limiting |
| Vulnerable plugin or theme | Equally exposed | Equally exposed |
| OS and PHP patches | The host | You (or the host on a managed VPS) |
In practice: the VPS gives you the isolation and the tools, and step 1 of the setup below (harden the server first) is what switches them on. The rule that prevents the most hacks is the same on any hosting: few plugins, all kept updated, and backups stored off the server.
What to look for in a VPS for WordPress
RAM
The resource WordPress and its database run out of first, especially with WooCommerce, page builders or many plugins. Memory exhaustion is the usual cause of a site falling over under load, so size with headroom rather than to the bare minimum.
CPU and storage
A couple of vCPUs handle a typical site; CPU-bound work (SSR, image processing, busy carts) wants more, ideally dedicated rather than burstable. Insist on NVMe or SSD storage - disk speed shows up directly in database query times and admin responsiveness.
Location, backups and support
Pick a datacenter region near your audience to cut latency on every request. Make sure automated backups are included or affordable - a one-click restore turns a bad plugin update into a five-minute fix. On an unmanaged plan, support response time matters most when something breaks at 2am.
Providers known for generous resources-per-price, such as Contabo, make a self-run WordPress VPS realistic on a modest budget - you get the CPU and RAM headroom a database-backed site likes without paying dedicated-server money.
How to set it up: the LEMP stack
The common modern stack for WordPress on a VPS is LEMP - Linux, Nginx, MySQL/MariaDB and PHP. Here's the shape of a fresh install on Ubuntu.
1. Harden the server first
sudo apt update && sudo apt upgrade -y
sudo adduser deploy && sudo usermod -aG sudo deploy
sudo ufw allow OpenSSH
sudo ufw allow 80,443/tcp
sudo ufw enable 2. Install Nginx, MariaDB and PHP
sudo apt install -y nginx mariadb-server \
php-fpm php-mysql php-curl php-gd php-xml php-mbstring php-zip
sudo mysql_secure_installation 3. Create the database and user
sudo mysql
CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8mb4;
CREATE USER 'wp_user'@'localhost' IDENTIFIED BY 'a-strong-password';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wp_user'@'localhost';
FLUSH PRIVILEGES;
EXIT; 4. Download WordPress
cd /var/www
sudo curl -O https://wordpress.org/latest.tar.gz
sudo tar -xzf latest.tar.gz
sudo chown -R www-data:www-data /var/www/wordpress 5. Point Nginx at the site
A minimal server block tells Nginx to serve WordPress and pass PHP to PHP-FPM:
server {
listen 80;
server_name example.com www.example.com;
root /var/www/wordpress;
index index.php;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php-fpm.sock;
}
} Enable the config, reload Nginx, then finish the famous five-minute install in the browser:
sudo ln -s /etc/nginx/sites-available/wordpress /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx 6. Add HTTPS
Free TLS via Let's Encrypt is a couple of commands and should never be skipped on a public WordPress site:
sudo apt install -y certbot python3-certbot-nginx
sudo certbot --nginx -d example.com -d www.example.com After install: keep it healthy
- Turn on automatic security updates for the OS and keep PHP on a supported version.
- Set up off-server backups of files and the database - don't rely on a single host snapshot.
- Add a caching layer (page cache plus an object cache like Redis) once traffic grows.
- Harden WordPress itself: strong logins, fewer plugins, and prompt core/plugin updates.
Who it's for
- Developers and capable site owners who want control and don't mind sysadmin → a VPS is a great fit.
- Heavier sites (WooCommerce, membership, multiple sites) that have outgrown shared hosting → a VPS for dedicated resources.
- Small sites or anyone who'd rather not run a server → managed WordPress hosting is the better value.
How to decide
Run WordPress on a VPS when you genuinely want - and will do - the control it offers: a heavier or growing site, a custom stack, or several sites on one box. Size RAM first, insist on NVMe storage and a nearby region, and treat automated backups and HTTPS as non-negotiable. If the server upkeep feels like a chore rather than a tool, choose managed hosting instead - the {right} answer is the one that matches how much of the stack you actually want to own.