How do you host a website with nginx and HTTPS on a VPS?
Short answer
To serve a site over nginx and HTTPS on a VPS, aim the domain's DNS (A and AAAA) at the machine, install nginx, describe the site in a server block, then let certbot --nginx fetch a free Let's Encrypt certificate and schedule its renewal. VPSRomania VR 2 handles a personal site for $5.44 a month, paid in crypto.
In brief
- DNS before anything: A record towards the IPv4, AAAA towards one address inside the /64.
- nginx: each site gets its own file under sites-available, switched on by a symlink.
- HTTPS: certbot --nginx fetches the certificate, edits the block and sets up renewal.
- Firewall: ufw allow 'Nginx Full' opens ports 80 and 443.
- Mail from the site: port 25 is closed, so contact forms send through a relay on 587.
Which VPS plan does an nginx website need?
nginx itself uses a few megabytes; the application behind it sets the size. These are starting points, not limits.
| Kind of site | Software behind nginx | Suggested plan | Per month |
|---|---|---|---|
| Static site, docs, landing page | nginx only | VR 1, 1 GB RAM | $4.82 |
| Personal blog or small WordPress | nginx, PHP-FPM, MariaDB | VR 2, 2 GB RAM | $5.44 |
| Business site, small shop | nginx, PHP or Node, database, cache | VR 4, 4 GB RAM | $9.08 |
| Several sites or a busy shop | Same, plus workers and search | VR 8, 8 GB RAM | $14.90 |
Every plan has NVMe storage, one IPv4, a /64 of IPv6 and a shared 1 Gbit/s port.
How to put a site online with nginx and a free certificate?
Aim the DNS at the server
In the DNS panel of your registrar, give example.com and www an A record with the IPv4 and an AAAA record with one IPv6 from the /64. Carry on once dig example.com answers with the new address.
Install nginx and open the firewall
Run apt install nginx, then ufw allow 'Nginx Full'. Visiting the IP now shows the nginx welcome page.
Create the site
Put the files in /var/www/example.com and write a server block in /etc/nginx/sites-available/example.com.
Enable and test
Link the file into /etc/nginx/sites-enabled/, run nginx -t, then systemctl reload nginx.
Get the certificate
Install certbot and python3-certbot-nginx, then run certbot --nginx with both names. Choose the redirect so HTTP sends visitors to HTTPS.
Check renewal
Run certbot renew --dry-run. A systemd timer shipped with the package then renews each certificate ahead of its expiry date.
server {
listen 80;
listen [::]:80;
server_name example.com www.example.com;
root /var/www/example.com;
index index.html;
location / {
try_files $uri $uri/ =404;
}
}apt install -y nginx certbot python3-certbot-nginx
ufw allow 'Nginx Full'
mkdir -p /var/www/example.com && echo '<h1>It works</h1>' > /var/www/example.com/index.html
ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/
nginx -t && systemctl reload nginx
certbot --nginx -d example.com -d www.example.com
certbot renew --dry-runWhy is nginx a good web server for a small VPS?
nginx serves static files and proxies applications with a small, steady memory footprint, which matters on a 1 or 2 GB server. Its event-driven design keeps thousands of idle connections open without one process per visitor. It also sits well in front of anything else: PHP-FPM for WordPress, a Node or Python app on a local port, or a Matrix server. Debian and Ubuntu package it with a sites-available and sites-enabled layout, so each domain lives in its own file. Caddy is a fine alternative that handles certificates by itself; nginx with Certbot remains the most documented pairing.
How does Certbot get and renew the certificate?
Certbot proves to Let's Encrypt that you control the domain by answering an HTTP challenge on port 80, then installs the certificate and a renewal timer. So the domain has to resolve to this machine first, and port 80 has to remain reachable after HTTP starts redirecting to HTTPS. Certificates are short-lived, 90 days on the default profile when this guide was written, and Certbot renews them well before expiry. The Certbot site recommends its snap package on systems with snapd; the Debian and Ubuntu packages used above work the same for a single server. If renewal ever fails, Let's Encrypt rate limits apply to repeated attempts, so fix the cause before retrying.
Can the website send email from the VPS?
It can send through an authenticated relay on port 587 or 465, but never straight out on port 25, blocked across all VPSRomania servers. Contact forms, password resets and order confirmations should use an SMTP relay or a transactional mail provider; WordPress plugins and most frameworks accept SMTP settings. That setup also lands in inboxes more often than mail sent straight from a fresh IP address would.
Where should the website's server be?
Close to most visitors and under a law you are comfortable with. A Bucharest server sits inside the EU under the GDPR, a median 26 ms from Frankfurt and 42 ms from Warsaw; the website hosting in the eu use case covers the legal side. According to VPSRomania's survey of 30 November 2026, a crypto-paid server with one vCPU and 2 GB sold for $8.87 a month at the Romanian median, against $5.44 for VR 2. Moving an existing site? Follow migrate website to new vps. The bucharest vps page lists the plans, and ufw firewall vps explains the firewall rule.
Nginx and HTTPS questions
Is Let's Encrypt good enough for a business website in 2026?
Yes. Browsers trust it like any paid domain-validated certificate. Paid certificates add organisation checks or warranties, not stronger encryption.
Why does certbot fail with a connection or DNS error?
Usually the domain does not point at the server yet, or port 80 is closed. Check dig example.com and ufw status, then retry.
Does one nginx server handle more than one website?
Yes. Give every domain its own block with a distinct server_name and root folder, then run certbot --nginx for each, or once with all the names.
Which is the best plan for WordPress with nginx?
VR 2 for a personal blog, VR 4 at $9.08 a month once a shop, page builder or several plugins come in.
Does VPSRomania include a control panel like cPanel?
No. The servers are plain Linux with root access; nginx and Certbot as shown here, or a free panel you install yourself, replace it.
Verdict
- DNS, nginx, one server block and one certbot command give a VPS-hosted site HTTPS in about fifteen minutes.
- Keep port 80 open for renewals and send site mail through a relay on 587.
Host your website in Bucharest
VR 2 in Bucharest: a single vCPU, 2 GB of memory, 40 GB of NVMe and 4 TB of traffic for $15.50 over 3 months.
Sources (5)
- Beginner's guide — nginx.org (read 30 Nov 2026)
- Configuring HTTPS servers — nginx.org (read 30 Nov 2026)
- Certbot instructions — Electronic Frontier Foundation (read 30 Nov 2026)
- How Let's Encrypt validates domains — Let's Encrypt (read 30 Nov 2026)
- Rate limits — Let's Encrypt (read 30 Nov 2026)