Features
Several Sites on One Service
One service can answer for more than one domain and show a different site on each. A common setup: your main site on example.com, a blog on media.example.com, and a product landing page on shop.example.com, all built and deployed together from one repository.
This is a normal way to host on ZevCloud. Every domain you attach is served by the same running service, within that service’s plan.
When it fits
Good fits:
- Sister sites or brands that belong to you and ship together
- A marketing site and the app behind it
- A subdomain per product or per region
- A multi-tenant app that shows each of your customers their own content on their own domain
Better as separate services:
- Sites that need to deploy on their own schedule. One deploy ships every site on the service.
- Sites with very different traffic. They share one plan’s CPU, memory and bandwidth, so a busy site can slow the others.
- Sites that need their own logs, metrics or environment variables
How it works
- Attach each domain to the service. In the service’s Domains tab, add every domain and subdomain you want it to answer for, and set their DNS as described in Custom Domains. Each one gets its own SSL certificate automatically.
- Route by hostname in your app. Every request carries the domain the visitor asked for in its
Hostheader. Your app reads it and serves the right site. ZevCloud doesn’t decide which site to show; your code does.
Examples
Several static builds behind Caddy
Build each site into its own folder, then serve them from one container with a Caddyfile. Deploy it with a Dockerfile.
{
auto_https off
}
:{$PORT:3000} {
@media host media.example.com
handle @media {
root * /srv/media
try_files {path} /index.html
file_server
}
@shop host shop.example.com
handle @shop {
root * /srv/shop
try_files {path} /index.html
file_server
}
# Everything else, including example.com and your zevcloud.app address
handle {
root * /srv/main
try_files {path} /index.html
file_server
}
}FROM caddy:2-alpine
COPY Caddyfile /etc/caddy/Caddyfile
COPY apps/main/dist /srv/main
COPY apps/media/dist /srv/media
COPY apps/shop/dist /srv/shopKeep auto_https off: ZevCloud issues and renews the certificates for your domains in front of your service.
nginx
server {
listen 3000;
server_name media.example.com;
root /usr/share/nginx/media;
location / { try_files $uri /index.html; }
}
server {
listen 3000 default_server;
server_name _;
root /usr/share/nginx/main;
location / { try_files $uri /index.html; }
}The default_server block catches every hostname you didn’t list, including your zevcloud.app address.
Next.js middleware
Rewrite each hostname to its own folder under app/, so media.example.com/about renders app/media/about/page.tsx:
// middleware.ts
import { NextResponse, type NextRequest } from 'next/server';
const SITES: Record<string, string> = {
'media.example.com': 'media',
'shop.example.com': 'shop',
};
export function middleware(req: NextRequest) {
const host = (req.headers.get('host') ?? '').split(':')[0];
const site = SITES[host];
if (!site) return NextResponse.next(); // main site
const url = req.nextUrl.clone();
url.pathname = `/${site}${url.pathname}`;
return NextResponse.rewrite(url);
}
export const config = { matcher: ['/((?!_next|favicon.ico).*)'] };Express
app.use((req, res, next) => {
const host = req.hostname; // without the port
if (host === 'media.example.com') return mediaRouter(req, res, next);
if (host === 'shop.example.com') return shopRouter(req, res, next);
return mainRouter(req, res, next);
});For a multi-tenant app, look the hostname up in your database instead of a fixed list, and show a not-found page for hostnames you don’t recognise.
Things to know
- Always have a fallback. Your service’s
zevcloud.appaddress and any domain you haven’t mapped yet still reach your app. Send them to your main site or a clear not-found page, not an error. - One deploy, every site. A failed build or a crash takes all the sites on the service down together. Metrics and logs cover the service as a whole.
- SEO stays per domain. Give each site its own canonical URLs,
sitemap.xmlandrobots.txt, and serve the right one for each hostname. - Primary domain. The domain marked primary in the Domains tab is what the dashboard links to. It doesn’t change what your app serves on the others.
- Same rules everywhere. The Acceptable Use Policy applies to what you serve on every domain attached to your service.
Updated at, Friday, November 27, 2026