Blog / Wildcard subdomains
Wildcard subdomains on a NAT VPS: a subdomain for every customer
2 December 2026 · Guide · By Mohammad AlSaraf
On a NAT VPS your server shares its IPv4 address with other servers, so ports 80 and 443 can't simply be yours. We route them by name instead: when a visitor asks for example.com, the request goes to the server that linked that name. Until now that meant linking every name on its own. If you run an app that gives each of its customers a subdomain, such as alice.myapp.com and bob.myapp.com, you had to add each one by hand and you ran into your plan's domain limit.
Since 1 December you can link a wildcard instead: *.myapp.com. Every subdomain of myapp.com then reaches your server, new ones included, and the wildcard counts as one domain. It works on all paid plans, from Nano at $1 a month. As far as we know, few NAT VPS hosts offer this on a shared IPv4 address.
About 15 minutes. You need a paid natbox server, a domain whose DNS you control, and nginx (the same idea works with Caddy or Apache).
When a wildcard helps
- An app with one subdomain per customer: a small SaaS, a hosted bot dashboard, AI agents with their own address, team spaces.
- Preview sites: a subdomain per branch or per pull request, created by a script, with nothing to change on our side.
- Many small sites under one domain:
blog.,shop.,status.and so on, without counting each one against your plan.
How a request finds your server

- Names you link on their own win. If
shop.myapp.comis linked separately, it goes where that link says, even with a wildcard in place. - Any depth.
*.myapp.comcoversalice.myapp.comand alsoeu.alice.myapp.com. If someone links a longer wildcard such as*.eu.myapp.com, the longer one wins for its names. - Not the bare domain.
myapp.comitself is not a subdomain, so link it as its own name if you use it. - HTTPS stays yours. For port 443 we read only the name the browser sends at the start of the connection, then pass the encrypted connection straight to your server. We never hold your certificate or see your traffic.
1. Link the wildcard
Open your server in the client area, go to the Domains tab and add *.myapp.com. The tab then shows two records to create where your DNS is managed:
| Type | Name | Value |
|---|---|---|
| A | *.myapp.com | your server's shared IPv4 address (shown on the tab) |
| TXT | _natbox.myapp.com | the natbox-verify=… code shown on the tab |
Then press Verify. We look for the TXT record, and we check the wildcard itself by asking public DNS for a random name under myapp.com: it has to point only to your server's IPv4 address. New records can take a few minutes, sometimes up to an hour, to show up. Optionally add an AAAA record for *.myapp.com pointing to your server's IPv6 address, so IPv6 visitors reach you directly.
2. One nginx block for every customer
On your server, one server block can answer for every subdomain. A regular expression in server_name captures the first part of the name, and nginx uses it to pick that customer's folder. Here it is on our demo server, for the test name myapp.test:
![Terminal: the file /etc/nginx/sites-available/myapp with one server block, listen 80, server_name ~^(?<customer>[a-z0-9-]+)\.myapp\.test$, root /srv/customers/$customer and try_files.](/assets/blog/wildcard-subdomains-on-a-nat-vps/1-nginx.png)
With that, adding a customer is creating a folder: nothing to change in nginx, and nothing in the client area. Here is the demo from the outside, after linking *.myapp.test. The --resolve option stands in for DNS, because .test names don't exist on the internet:

Alice and bob each get their own site. Carol has no folder yet, so your nginx answers 404: the request did reach your server. The bare myapp.test is not covered by the wildcard, so our front door answers instead.
If each customer runs their own app instead of static files, map the name to a port and proxy to it:
map $customer $backend {
alice 127.0.0.1:3001;
bob 127.0.0.1:3002;
}
server {
listen 80;
server_name ~^(?<customer>[a-z0-9-]+)\.myapp\.com$;
location / {
if ($backend = "") { return 404; }
proxy_pass http://$backend;
proxy_set_header Host $host;
}
}
3. HTTPS for every subdomain
Let's Encrypt only issues wildcard certificates after a DNS check: you prove control of the domain with a TXT record. The quickest way to try it is by hand:
certbot certonly --manual --preferred-challenges dns \
-d myapp.com -d '*.myapp.com'
For renewals without manual steps, use the certbot DNS plugin for your DNS provider. With Cloudflare, for example: apt install python3-certbot-dns-cloudflare, put an API token with DNS edit rights in /root/.secrets/cloudflare.ini (chmod 600), then:
certbot certonly --dns-cloudflare --dns-cloudflare-credentials /root/.secrets/cloudflare.ini \
-d myapp.com -d '*.myapp.com'
Then add listen 443 ssl; and the ssl_certificate lines to the same server block. Because port 80 also reaches your server, the normal HTTP check (certbot --nginx -d alice.myapp.com) works too, one name at a time. That is fine for a handful of customers; the wildcard certificate is easier once there are many.
Another way: your own IPv6 behind Cloudflare
Every natbox server also has its own block of IPv6 addresses, open on every port. If your domain is on Cloudflare, a proxied (orange cloud) wildcard AAAA record pointing to your server's IPv6 address works without linking anything: Cloudflare accepts visitors over IPv4 and IPv6 and connects to your server over IPv6. Its free certificate covers one level of wildcard (*.myapp.com), not two (*.agents.myapp.com). Linking the wildcard on natbox, as above, has no such limit and needs no Cloudflare.
Good to know
- A wildcard counts as one domain on your plan (3 on Nano, 10 on Box, 25 on Box Plus, Box Max and Box CPU).
- Wildcards are for paid plans. Free trials and burner servers can still link ordinary names.
*.natbox.ioand other natbox.io names can't be linked.- The docs and the Domains tab show the same steps, with your server's own address filled in.
Building something with a subdomain per customer on natbox? We'd like to hear about it, and it could be a good entry for our "Write about natbox" contest, open until 15 December.
Get new tutorials in Telegram. Follow @natboxio: every new post, plus short server tips.
More from the blog: November 2026 uptime report: 21 problems, and what caused them, Our first measurement report: 33 studies from a $1 VPS host, Your natbox disk holds about twice what it says. RSS feed.