Disclosure: this page contains affiliate links. If you buy through them we may earn a commission at no extra cost to you.
Nginx powers a large share of the web, and on a VPS you get full root control with no shared-hosting limits. This guide assumes a fresh Ubuntu 24.04 server.
Step 1: Install Nginx
sudo apt update
sudo apt install -y nginx
Then allow web traffic through the firewall:
sudo ufw allow 'Nginx Full'
Step 2: Add a server block
Server blocks (like Apache virtual hosts) let one VPS serve multiple domains. Create a config file:
sudo nano /etc/nginx/sites-available/example.com
server {
listen 80;
server_name example.com;
root /var/www/example.com;
index index.html;
}
Step 3: Enable it and reload
sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/
sudo mkdir -p /var/www/example.com
sudo nginx -t && sudo systemctl reload nginx
Point your domain’s A record at the VPS IP address and the site is live. Next step: add free HTTPS with Let’s Encrypt.
Any KVM VPS with full root access runs this easily. RackNerd’s 1 GB plan at $21.99/yr is plenty for a static site or small PHP app, with a dedicated IPv4 included.
See RackNerd's current deals