VPS or web hosting: which one for your site
Let us start with what saves you needless cost and work: for a showcase site, a blog or a standard WordPress site, web hosting is enough. The server, its updates and the certificate are not your concern there. The guide web hosting or VPS compares the two point by point.
A VPS makes sense when you recognise yourself in one of these situations:
- Your site is not a standard PHP site: a Node.js, Python or Go application, an API, a service that runs continuously or background jobs.
- You need specific software or a specific version: a version of PHP, Node.js or PostgreSQL, Redis, a search engine, settings outside what shared hosting allows.
- You host several sites with different needs, each with its own settings, database and certificate.
- You want reserved resources: vCPU and memory of your own, rather than an account on a shared machine.
- You deploy with Docker: one
compose.yaml file per application, just as on your development machine.
For WordPress in particular, the WordPress VPS page explains when a VPS makes sense. A slow site is not, on its own, a reason to switch: oversized images or heavy code will follow the site onto a VPS.
Which stack to install on the VPS
Three ways to do it, depending on the site:
- A PHP site: Nginx (or Apache), PHP-FPM and MariaDB, from the Debian or Ubuntu packages. The database listens locally only, never on the public address.
- A Node.js or Python application: the application listens on
127.0.0.1, started by a systemd service that restarts it after a crash, and Nginx serves it to the public as a reverse proxy.
- With Docker: one folder and one
compose.yaml file per application, and a single reverse proxy on ports 80 and 443, for example Nginx Proxy Manager. Docker installs with the official script: see installing Docker on a VPS.
sudo apt update && sudo apt install -y nginx mariadb-server php-fpm php-mysql
sudo mariadb-secure-installation
sudo nginx -t && sudo systemctl reload nginx
For an application listening on port 3000, the Nginx server block serves it like this:
location / {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
The guide hosting a website on a VPS walks through the full go-live with Nginx, from the domain to the HTTPS padlock. For the tier, start from memory: add up the PHP processes or the application, the database and the cache, then keep some headroom. The free -h command shows what is left once the site is live.
HTTPS and several sites on a VPS
- Point the domain to the VPS's IPv4: an A record for the bare domain and one for
www. No domain yet? You can register one on the domain names page.
- Create one configuration file and one folder per site, each with its own
server_name. A single VPS can serve as many domains as its resources allow.
- Get a free certificate with Certbot, which also configures Nginx for HTTPS and sets up automatic renewal:
sudo apt install -y certbot python3-certbot-nginx
sudo certbot --nginx -d example.com -d www.example.com
sudo certbot renew --dry-run
The last command checks that renewal will work. The details are in the guide Certbot and Let's Encrypt; with Docker, Nginx Proxy Manager obtains and renews certificates from its interface. So that one busy site does not slow down the others, give each PHP site its own PHP-FPM pool and its own database.
Security and maintenance: what remains your responsibility
On a VPS, you are the administrator. Before putting a site online, and throughout its life:
- access: SSH key login, a firewall limited to SSH, HTTP and HTTPS, automatic system security updates, with the guide securing a Linux VPS;
- the application: CMS, plugins and dependencies to keep up to date, after reading the release notes;
- Docker: ports published by Docker bypass UFW rules. Publish on
127.0.0.1 anything that does not need to leave the VPS;
- backups: the site's files and a database export, every night, copied off the VPS, with a restore tested from time to time.
A VPS is not the right choice if:
- you do not want to administer anything: web hosting handles it;
- you rely on mailboxes: a VPS does not include any, and running a mail server yourself is a job of its own (see business email);
- your software needs a kernel module or a hypervisor: our Linux VPS are LXC containers, and a dedicated server gives you the whole machine;
- your visitors are far from France: our servers are in France, and distance costs loading time.