Host multiple apps on one VPS

Domain Routing is a reverse proxy: a service that forwards each request to the right app. It sends traffic for a domain or subdomain to a port inside your container. Give each app its own port and its own name, and one container serves all of them.

What you need

Example: three apps, three names

  • app.yourdomain.com points to port 3000, the frontend.
  • api.yourdomain.com points to port 3001, the API.
  • admin.yourdomain.com points to port 8081, the admin app.

Free subdomains work the same way, for example myapp.vps.nasiadka.pl and myapi.vps.nasiadka.pl. On vps.nasiadka.pl, the names app, api, admin, www and dev are reserved, so choose more specific names.

The Domain Routing page listing three routes: demo-app on port 3000, demo-api on port 3001 and demo-admin on port 8081
Three apps in one container: each subdomain points to its own port.

Add the routes

  1. Run each app on its own port

    Make each app listen on 0.0.0.0 and on a different port. To keep the apps running after you close SSH, see Keep your apps running with PM2.

  2. Add one route per app

    In Domain Routing, enter the full domain name (for example api.yourdomain.com or myapi.vps.nasiadka.pl) and the target port, then click "Add Route". Repeat for each app.

Follow along on your own container

Already have an account? Sign in to try this guide on your container. Accounts are created by invitation.

Sign in