Deploying Multiple Projects on One VPS: The Nginx Structure I Use
I have several side projects running together on one VPS — from this personal site, to other apps, to a few smaller domains. Instead of renting a separate server per project (expensive and wasteful), I use a single VPS with Nginx as a reverse proxy/static file server for all of them.
The structure I use is fairly standard but consistent:
One config file per domain. Each project has its own config file in /etc/nginx/sites-available/, symlinked into sites-enabled/ when active. This makes it easy to enable/disable a project without disturbing the others.
Static site vs. proxy, clearly separated. Static projects (like this site) point root directly at the build output directory. Projects that need a backend (an app with an API, for instance) use proxy_pass to the local port where the app is running.
SSL per domain, managed by Certbot. Each domain has its own certificate, auto-renewed via Certbot. No mixed wildcard certs that get messy if one domain runs into trouble.
Resource isolation when needed. For heavier applications, I run them in a separate Docker container, with Nginx still acting as the single entry point proxying to each container’s port.
The biggest benefit: one VPS can efficiently host many small-to-medium projects, and if one project needs maintenance, the others aren’t affected — as long as the configs are actually kept separate correctly.