Self-hosted tools for developers, such as analytics, automation, caches and your own apps, can all run on one VPS. You pay a predictable monthly cost, keep your data under your control and skip per-seat pricing. The trade-off is that you become the operations team. This guide sets out a small, sane baseline for a self-hosted stack and points to a step-by-step tutorial for each piece.
Quick answer: This guide covers which tools are worth self-hosting, a baseline for one server (Nginx, free TLS, Docker Compose or PM2, a firewall and tested backups) and a checklist before you go live. On a fresh VPS, start with SSH keys and the firewall, then deploy one app behind Nginx.
- Decide what to self-host and what to leave to a provider.
- Lock the server down: SSH keys and a firewall with a short allow list.
- Put Nginx with a free TLS certificate in front of every app.
- Run each app with Docker Compose, or with PM2 for a plain Node.js app.
- Schedule backups and test a restore before you rely on the server.
In this guide
What Is Worth Self-Hosting (and What Is Not)
- Good candidates: web apps and APIs, automation tools such as n8n or Activepieces, analytics such as Umami, caches and queues such as Redis, internal dashboards and staging sites.
- Think twice: outbound email delivery and anything where downtime costs you customers and you have nobody on call. Email in particular depends on IP reputation that a new server does not have.
Where to Start
Pick the line that matches what you are doing today:
- Fresh VPS, nothing on it yet: generate an SSH key for GitHub on the VPS so you can pull code, then apply the firewall example below.
- Deploying a Node.js app: follow the guide to deploy Node.js on a VPS with Nginx, DNS and SSL.
- Deploying a containerised app: start with Docker Compose on a VPS with DNS and SSL.
- Adding a self-hosted tool: Umami analytics is a small first project; n8n with PostgreSQL is a larger one.
A Baseline Stack for One Server
- A reverse proxy in front of everything. Nginx terminates TLS (it handles the HTTPS encryption), routes each domain to the right app and serves static files. Apps listen on localhost only.
- Free TLS certificates that renew themselves. Certbot with Let’s Encrypt covers single domains over HTTP-01 and wildcard domains over DNS-01.
- One Docker Compose file per app. The app, its database and its volumes are described in one place, which makes moving servers and rolling back far easier.
- A process manager for bare Node.js apps. If you do not containerise, PM2 restarts crashed processes, starts them on boot and rotates logs.
- A firewall with a short allow list. Open SSH, 80 and 443. Databases and Redis should never be reachable from the internet.
- Backups you have restored at least once. Copy database dumps and uploaded files off the server on a schedule, and test the restore before you need it.
Example: A Minimal Firewall on Ubuntu
Run these commands on the server over SSH, as a user with sudo. Allow SSH before you enable the firewall, otherwise you lock yourself out of the server.
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow OpenSSH
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable
sudo ufw status verboseThe last command should report Status: active, a default policy that denies incoming traffic, and allow rules for OpenSSH, 80 and 443. Open a second SSH session before you close the first one, to prove you can still get in.
If you use Docker, remember that ports published with -p 5432:5432 bypass UFW rules, because Docker manages its own firewall chain. Bind internal services to localhost instead, for example 127.0.0.1:5432:5432, or leave the port unpublished and let containers talk over a Docker network.
Checklist Before You Call It Production
- SSH uses keys only, with password login disabled.
- Automatic security updates are switched on.
- Every app has a health check and restarts on failure.
- Certificates renew automatically, and you have run
certbot renew --dry-runto prove it. - Backups run on a schedule, are stored on another machine or in object storage, and a restore has been tested.
- You know where the logs are and they are rotated so the disk cannot fill up.
All Tutorials in This Guide
Deployment, Nginx, SSL, caching and self-hosted tools, one task per tutorial.
- Configure Immutable Cache-Control and Cache Busting in NginxSet immutable Cache-Control in Nginx for content-hashed assets, keep index.html on no-cache, and avoid the add_header and CDN 404 traps.
- Configure Nginx Reverse Proxy for Node.js WebSockets and PM2Fix WebSocket 400 errors and 60-second drops behind Nginx: pass the Upgrade and Connection headers, raise proxy_read_timeout and run Node.js with PM2.
- Configure PM2 Startup Scripts and Log Rotation on a VPSConfigure PM2 on a VPS: an ecosystem file, cluster mode with zero-downtime reloads, a systemd startup script for reboots, and pm2-logrotate limits.
- Deploy a Docker Compose App on Hostinger VPS with Namecheap DNS and SSLDeploy a Docker Compose app on a Hostinger VPS: Namecheap DNS records, Nginx and Postgres containers, a Certbot certificate and automatic renewal.
- Deploy a Node.js Web App on Hostinger with Namecheap DNS and SSLDeploy a Node.js web app on Hostinger, point Namecheap DNS at it without breaking email, and turn on free SSL with Force HTTPS. Includes 503 fixes.
- Deploy FastAPI and React on Hostinger VPS with Namecheap DNSDeploy FastAPI and React on a Hostinger VPS: Gunicorn under systemd, a React build served by Nginx, Namecheap DNS, free SSL and CDN cache headers.
- Deploy Next.js on Hostinger VPS: PM2, Nginx, DNS & CDNDeploy Next.js on a Hostinger VPS: standalone build, PM2 as a non-root user, Nginx reverse proxy, Namecheap DNS, free SSL and CDN cache rules.
- Deploy Node.js on Hostinger VPS: Nginx, Namecheap DNS & Cache HeadersDeploy Node.js on a Hostinger VPS: PM2 keeps it running, Nginx proxies it, Namecheap DNS points to it and Certbot adds free SSL and CDN headers.
- Deploy Nuxt on Hostinger VPS: PM2, Nginx, Namecheap DNS & CDNDeploy a Nuxt 3 or Nuxt 4 SSR app on a Hostinger VPS: build with Nitro, run it under PM2, put Nginx in front, point Namecheap DNS and add free SSL.
- Fix CDN Font CORS Errors: Nginx Access-Control-Allow-OriginFix CDN font CORS errors in Nginx: add Access-Control-Allow-Origin to font files, avoid the add_header inheritance trap, then purge and verify the CDN.
- Fix Certbot SSL Auto-Renewal Failure on Nginx: ACME Challenge GuideCertbot renewal failing on Nginx? Read the dry-run error, fix ACME challenge 404, 403 and timeout errors, switch to webroot and reload Nginx on renewal.
- Fix SSL ERR_TOO_MANY_REDIRECTS on Nginx Behind a CDNERR_TOO_MANY_REDIRECTS after adding a CDN? Find the layer that loops, switch the SSL mode to Full (strict) and make Nginx and WordPress trust HTTPS.
- How to Generate an SSH Key for GitHub on a VPSGenerate an SSH key for GitHub on your VPS with ssh-keygen, add it as an account or deploy key, test it, and fix Permission denied (publickey).
- How to Set Up Nginx on Windows, macOS and Linux to Host a Node.js AppSet up Nginx on Windows, macOS or Linux as a reverse proxy for a Node.js app: install it, add a proxy_pass block, test, reload and fix 502 errors.
- How to Update n8n on Railway Without Losing WorkflowsUpdate n8n on Railway safely: back up Postgres and the encryption key, pin a version tag, update queue-mode workers together and roll back if needed.
- Install Namecheap SSL on Nginx: Combine CRT and CA-BundleInstall a Namecheap SSL certificate on Nginx: combine the CRT and CA-bundle in the right order, check the key matches, and verify the full chain.
- Let’s Encrypt Wildcard SSL with Certbot DNS-01 on NginxGet a Let's Encrypt wildcard certificate for *.example.com with Certbot DNS-01, install it on Nginx and make every renewal reload Nginx automatically.
- Point a Namecheap Subdomain to a Separate Server: DNS and Nginx SetupSend app.example.com to its own server: add an A record in Namecheap Advanced DNS, check it with dig, set up an Nginx server block and add free SSL.
- Prevent CDN Cache Stampedes with Origin Shield and Request CollapsingStop a CDN cache stampede from taking down your origin: Nginx request collapsing, stale-while-revalidate, an origin shield and a k6 test to prove it.
- Restrict Origin Traffic to CDN Shield IPs with UFW and NginxRestrict origin server traffic to your CDN's IP ranges with UFW and Nginx, keep SSH and SSL renewal working, and test that direct-to-IP requests fail.
- Self-Host Umami Analytics: Fast Docker Compose GuideSelf-host Umami Analytics with Docker Compose and PostgreSQL: a .env file, a localhost-only port, HTTPS through Caddy and the tracking script.
- Serve Pre-Compressed Brotli and Gzip Assets on NginxServe pre-compressed Brotli and gzip files on Nginx with brotli_static and gzip_static: install the module, build .br and .gz files and test with curl.
- Strip Marketing Query Strings at CDN Edge for Higher Cache HitsStop utm_source, fbclid and gclid from splitting your CDN cache. Strip marketing query strings from the cache key in Cloudflare, Varnish or Nginx.
FAQ
Is self-hosting cheaper than paying for SaaS tools?
Often, yes, in money: one VPS at a fixed monthly price can replace several per-seat subscriptions. Count your time as well, though. Updates, backups, certificate renewals and the occasional outage are now your job, so self-host the tools where control or cost really matters to you.
Should I use Docker Compose or PM2?
Use Docker Compose when the app needs a database or other services, or when you want the same setup on every server. PM2 is simpler for a single Node.js process that you run without containers. Many servers use both: Compose for tools, PM2 for one custom app.
How big a VPS do I need for self-hosted tools?
Start small and measure rather than guessing. Run your stack, watch memory with free -h and docker stats, and resize when usage stays high. Databases, search engines and local AI models are usually what push you to a larger plan.
Next Steps
Once the server is running, the API integrations and webhooks guide covers the application side: queues, retries and signature checks. For running language models on the same hardware, see building AI agents.

