Play ►Runtime 6 min#infrastructure#security#small business
A secure, load-balanced website with a private database for $40 a month
How to host a small business website on DigitalOcean with an nginx load balancer in a DMZ, private app and database servers, and fail2ban, for about $40 AUD a month.
Small businesses are often told they have two choices for hosting: a cheap shared host where security is somebody else’s problem, or a cloud setup that costs hundreds a month and needs a platform team to run it. There is a lot of room in between.
This is a setup I have built and run: a public-facing load balancer in its own DMZ, two application servers and a database that cannot be reached from the internet at all, firewalled at two layers, with automatic TLS, intrusion blocking and backups. It costs about $40 AUD a month, and every piece of it is mainstream open source software.
Every configuration file is in the companion repository, laid out by the server it goes on.
What you get for the money
| Item | Size | USD / month |
|---|---|---|
| Edge droplet (nginx, fail2ban, NAT) | 1 vCPU, 1 GB | $6.00 |
| App droplet 1 (private) | 1 vCPU, 1 GB | $6.00 |
| App droplet 2 (private) | 1 vCPU, 1 GB | $6.00 |
| Database droplet (private) | 1 vCPU, 1 GB | $6.00 |
| Weekly backups of the database droplet | 20% of droplet | $1.20 |
| VPC, cloud firewalls, traffic inside the VPC | $0.00 | |
| Total before GST | $25.20 |
With GST that is about $27.70 USD, or roughly $40 AUD at October 2026 exchange rates. DigitalOcean’s managed load balancer, managed PostgreSQL and NAT gateway together would cost more than twice this, and the NAT gateway alone costs more than all of it.
The shape of it
Internet
│ 443, 80 (SSH from your IP only)
┌────────▼─────────┐
│ edge │ public IP
│ nginx · fail2ban │ TLS, load balancing, rate limits
│ ufw · NAT │ outbound internet for the private servers
└────────┬─────────┘
│ VPC 10.10.0.0/24, no public IPs below this line
┌────────┴─────────┐
┌────▼────┐ ┌────▼────┐
│ app-1 │ │ app-2 │ your website or application
└────┬────┘ └────┬────┘
└────────┬─────────┘
┌────▼────┐
│ db │ PostgreSQL
└─────────┘
Only the edge server has a public IP address. The application servers and the database are DigitalOcean Private Droplets: they exist only inside the private network, so there is nothing on them for an attacker on the internet to scan. Everything reaches them through the edge, and the edge only passes on web traffic.
The IP addresses in the repository are examples. Use the ones DigitalOcean assigns you.
1. Create the network and the droplets
Create a VPC in Sydney (syd1), which keeps the site fast for Australian visitors and your customers’ data in Australia. Create the edge as a normal droplet in that VPC, and the two app servers and the database as Private Droplets. Through the API that is one field, "public_networking": false (script). A droplet’s private status is fixed when it is created, so decide before you click.
Then add two free DigitalOcean Cloud Firewalls:
- edge: allow inbound 80 and 443 from anywhere, and 22 only from your own IP address.
- private: allow inbound only from the VPC’s address range.
That is the first firewall layer. The second, ufw on each server, means one misconfiguration does not leave anything open.
2. Make the edge the private network’s way out
Private droplets cannot reach the internet by default, and they need to for security updates. Rather than pay about $40 USD a month for a managed NAT gateway, the edge does the job with a few lines of Linux networking:
- On the edge, allow forwarding from the VPC to the internet, turn on IP forwarding and add a NAT rule.
- On each private droplet, route outbound traffic through the edge, then check that
sudo apt updateworks.
To manage the private servers, use the edge as a jump host. Nothing else ever needs SSH exposed:
ssh -J you@edge.example.com.au you@10.10.0.3
3. Harden SSH everywhere
On every droplet, turn off root login and passwords. Create a normal user with sudo and your SSH key first, and check you can log in as them before restarting SSH. Ubuntu installs security updates automatically through unattended-upgrades. Leave it on.
4. nginx as the load balancer
On the edge, install nginx, certbot and fail2ban, and get a free Let’s Encrypt certificate. Certbot renews it automatically. Then use this site configuration, which gives you:
- Load balancing. Requests go to whichever app server has the fewest open connections. If one fails three times in ten seconds, nginx stops sending it traffic until it recovers, so you can update one server at a time without taking the site down.
- TLS at the edge. Visitors get HTTPS with modern protocols only, and the app servers never handle certificates.
- Rate limiting. Ten requests a second per IP, with a short burst allowance. Plenty for a person, and it blunts scrapers, credential stuffing and small floods.
- Security headers. HSTS, no MIME sniffing, no framing, and nginx does not advertise its version.
5. fail2ban to block repeat offenders
Rate limits slow attackers down. fail2ban bans them. When an IP keeps failing SSH logins, tripping the rate limit or probing for paths like /wp-admin, it adds a firewall rule that blocks it. The jail configuration bans for an hour after five strikes in ten minutes. Within a day of going live you will see bans: every public IP on the internet is scanned constantly.
6. The application servers
Run your site on port 3000 on both app droplets. It can be anything: Node, .NET, Python, PHP, or a static site behind a small local nginx. Deploy the same version to both, and firewall each one so it only accepts web traffic and SSH from the edge.
7. The database
Install PostgreSQL, have it listen on its private address, and allow only the two app servers, only over TLS, and only with a password:
hostssl appdb appuser 10.10.0.3/32 scram-sha-256
hostssl appdb appuser 10.10.0.4/32 scram-sha-256
Then firewall it the same way. The database now sits behind three walls: no public IP, a cloud firewall that only admits VPC traffic, and a host firewall and pg_hba.conf that only admit the two app servers.
8. Backups that actually restore
Turn on DigitalOcean’s weekly backups for the database droplet, and add a nightly pg_dump named for the day of the week, so you always have the last seven days. Then actually restore one into a scratch database. A backup you have never restored is a hope, not a backup.
The edge and app servers do not need backups if their configuration lives in Git. You can rebuild them faster than you can restore them.
What this does not give you
- The edge is a single point of failure. For another $6 USD a month you can run a second edge and move a DigitalOcean Reserved IP between them.
- So is the database. Backups protect the data, but a failure still means downtime while you restore. If that needs to be minutes rather than an hour, managed PostgreSQL with a standby is worth its price.
- You are the operations team. Budget an hour or two a month to read logs and watch disk space, or pay someone to.
- It suits steady traffic. For sudden floods of visitors, put a CDN such as Cloudflare’s free plan in front of the edge.
For most small and medium business websites those trade-offs are well worth it: real security, room to grow, and a monthly bill smaller than most software subscriptions.
If you would rather not build it yourself, this is the kind of work I do. Email hello@byrenhigg.in with a few lines on what you want to host, and I will tell you whether this setup fits and what it would take.