Skip to content

Own domain on a plain instance

Expose a backend plus a frontend on one OS instance under your own custom domain.

Own domain - backend and frontend on one instance

When this is for you

You are running your own backend and frontend on a plain OS instance (Ubuntu/Debian). You want visitors to reach both under your own hostname, for examplehttps://shop.example.com for the storefront andhttps://shop.example.com/api (or a subdomain) for the backend.

Option 1 — one site, one origin port

The simplest setup is one web site whose origin port is the port your server listens on. Run a single process (or a tiny reverse proxy such as Caddy inside the instance) that serves both the frontend and the backend, routing by path.

  • SSH into the instance and start your app so it listens on a port, e.g. 3000.
  • In Networking → Sites, set the web site origin port to 3000.
  • Attach your domain to the web site (see Custom domains).
  • Point an A record at your node’s public IP.

Visitors reach everything at https://your-domain.com; the edge forwards to your instance on port 3000.

Option 2 — separate sites for frontend and backend

If you prefer separate processes (frontend on 3000, backend API on 8000), add a second site with its own label and origin port. The frontend stays on web; the API gets a label such asapi.

  1. Run the frontend on port 3000 and the backend on port 8000, both bound to 0.0.0.0.
  2. In Networking → Sites, keep web on origin port 3000.
  3. Add a site labeled api with origin port 8000.
  4. Attach your domain to web and a subdomain (for example api.your-domain.com) to api.

The public URLs become https://your-domain.com andhttps://api-your-domain.nairacloud.xyz (or the custom domain you attach toapi).

Important notes

  • Bind to 0.0.0.0 inside the instance. The edge proxies to the guest IP; listening only on 127.0.0.1 returns 502.
  • Origin ports 80 and 443 are owned by the node edge. Do not set a site origin port to 80 or 443 -- use your app’s real port (3000, 8000, etc.).
  • Denied origin ports: 22, 25, 53, 137, 138, 139, 445, 1900, and 5353 cannot be site origin ports.
  • Keep the DNS record DNS-only (no Cloudflare orange-cloud proxy) while the certificate is issued.
  • One hostname maps to one site. A custom domain already attached elsewhere cannot be claimed again.

Practical -- try it now

Get your domain live on a plain instance

  1. Deploy an Ubuntu 24.04 instance and SSH in.
  2. Start your app on port 3000 bound to 0.0.0.0.
  3. Copy the node’s public IP from Networking.
  4. Add an A record for your domain at your registrar, pointing at that IP.
  5. Set the web site origin port to 3000 and attach your domain to it.
  6. Wait for the checklist: DNS resolving, pointing here, certificate issued.
Ask a question...
Ctrl+I