Quick answer
How do I host a website on a VPS?
To host a website on a VPS, point your domain's A and AAAA records at the server, install nginx, put your files in a web root, write a server block, test it with nginx -t and reload. Then open ports 80 and 443 and add HTTPS. Every SaltVPS server has 1 dedicated IPv4 for this.
In brief
- DNS first: an A record for the IPv4 and an AAAA record for an IPv6 from the server's /64.
- Web server: nginx from the system repository is enough for static sites and reverse proxying.
- One file per site in
/etc/nginx/sites-available/, linked intosites-enabled/. - Always test with
nginx -tbefore a reload. - HTTPS comes last, with a free Let's Encrypt certificate.
How do you host a website on a VPS with nginx?
Example domain: example.com. Commands for Ubuntu and Debian, run as root.
Point the domain
At your DNS provider, create an A record for example.com and www with the server IPv4. Add AAAA records if you serve over IPv6.
Install nginx
Run
apt updatethenapt install nginx. The service starts on its own and serves a default page.Create the web root
Run
mkdir -p /var/www/example.comand upload your files there, with index.html at the top.Write a server block
Create
/etc/nginx/sites-available/example.comwith listen 80, listen [::]:80, server_name example.com www.example.com, root /var/www/example.com and index index.html.Enable the site
Run
ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/. Remove the default link if you do not need it.Test and reload
Run
nginx -t. If it reports the syntax is ok, runsystemctl reload nginx.Open the firewall and add HTTPS
Run
ufw allow 'Nginx Full'to open ports 80 and 443, then request a certificate with certbot.
Which DNS records does a website on a VPS need?
Two or four records cover most sites; mail needs its own records and a mail provider.
| Record | Name | Points to | Needed for |
|---|---|---|---|
| A | example.com | Server IPv4 | Visitors on IPv4 |
| A | www | Server IPv4 | The www address |
| AAAA | example.com | One IPv6 from the server's /64 | Visitors on IPv6 |
| AAAA | www | Same IPv6 | The www address on IPv6 |
| MX | example.com | Your mail provider's host | Receiving email, handled outside the VPS |
What does a minimal nginx server block contain?
Five lines inside a server { } block are enough for a static site:
listen 80;andlisten [::]:80;server_name example.com www.example.com;root /var/www/example.com;index index.html;location / { try_files $uri $uri/ =404; }
For an app that listens on a local port, such as Node.js on 3000, replace the location body with proxy_pass http://127.0.0.1:3000;. On AlmaLinux and Rocky Linux, nginx reads extra files from /etc/nginx/conf.d/ instead of sites-enabled.
Which VPS plan is best for hosting a website?
A static site or a small blog runs well on the smallest plans; a dynamic site with a database wants more RAM. SaltVPS checked its plan list on 16 November 2026: disks run from 40 GB NVMe on Grain to 640 GB NVMe on Dome, with 2 TB to 12 TB of traffic a month. The plan list pairs Flake (1 vCPU / 4 GB / 80 GB) with WordPress, at $4.50 a month on 12 months.
Compare all plans on the pricing page or read the self-hosting comparison. Moving an existing site? The migration guide covers files, databases and DNS.
How do you add HTTPS to the site?
Run certbot with its nginx plugin once DNS points at the server. It proves you control the domain, edits the server block and sets up renewal. The Let's Encrypt guide walks through each command.
One limit to know before you host a website on a VPS here: outbound port 25 is closed on every SaltVPS server. Contact forms and WordPress mail should send through a mail provider on port 465 or 587.
Hosting a website on a VPS: questions
Nginx or Apache for a website on a VPS?
Both work. Nginx is lighter for static files and reverse proxying; Apache suits sites that rely on .htaccess files.
Can I host several websites on one VPS?
Yes. Add one server block per domain, each with its own server_name and web root.
How long until DNS points at the new server?
It depends on the record's TTL. Records with a short TTL change within minutes; older cached answers can last up to the TTL value.
Where are the nginx logs?
In /var/log/nginx/: access.log for requests and error.log for problems.
Can I host a WordPress website on a VPS?
Yes. Add PHP-FPM and MariaDB or MySQL next to nginx, and send WordPress mail through an SMTP plugin on port 465 or 587.
Verdict
- Hosting a website on a VPS takes DNS records, nginx, one server block and a certificate.
- Plan by RAM: static sites fit Grain; WordPress and databases fit Flake or larger.
Sources (3)
- nginx beginner's guide — nginx.org (2026-11-16)
- How nginx processes a request (server names) — nginx.org (2026-11-16)
- Ubuntu Server documentation: web servers — Canonical (2026-11-16)
Host your site on your own server
Flake comes with 4 GB of RAM, 80 GB NVMe and a dedicated IPv4, paid in crypto.
- Built by a person, 1 hour at most after confirmation
- Lost days credited back if a server cannot be delivered
- Pay in BTC, XMR, USDT, USDC, ETH, SOL or LTC
- DomaineGoat LLC · Panama