Guides / Multiple websites
Host multiple websites on one server
One server can run many websites. Visitors arrive on the same ports, and your web server picks the right site by domain name. This is the same idea our router uses to find your server, one step further.
1. Check how many domains your plan links
| Plan | Domains | That is enough for |
|---|---|---|
| Free trial | 2 | 1 site with www |
| Nano | 3 | 1 site with www, plus 1 subdomain |
| Box | 10 | 5 sites with www |
| Box Plus, Box CPU | 25 | 12 sites with www |
Each name counts: example.com and www.example.com are two domains. Over IPv6 there is no such limit, but IPv4 visitors can only reach linked domains.
2. Link each domain
For every name, add it on the Domains tab and create the A, TXT and AAAA records it shows, as in the website guide. All your sites can point to the same IPv6 address.
3. Give each site its own folder and config
mkdir -p /var/www/site-one /var/www/site-two
echo "Site one" > /var/www/site-one/index.html
echo "Site two" > /var/www/site-two/index.html
Save as /etc/nginx/sites-available/site-one, and make a copy for each other site with its own names and folder:
server {
listen 80;
listen [::]:80;
server_name site-one.example www.site-one.example;
root /var/www/site-one;
index index.html;
location / {
try_files $uri $uri/ =404;
}
}
ln -s /etc/nginx/sites-available/site-one /etc/nginx/sites-enabled/
ln -s /etc/nginx/sites-available/site-two /etc/nginx/sites-enabled/
nginx -t && systemctl reload nginx
4. Add HTTPS to each site
apt install -y certbot python3-certbot-nginx
certbot --nginx -d site-one.example -d www.site-one.example
certbot --nginx -d site-two.example -d www.site-two.example
Each site gets its own certificate, and certbot renews them for you. Our router passes HTTPS through untouched, so this works the same as on any server.
5. Check each one
curl -I https://site-one.example
curl -I https://site-two.example
If one shows another site's page, check the server_name line in its config. If the domain does not reach your server at all, check it shows as verified on the Domains tab.
Good to know
- Static sites use very little memory. Each site with PHP, a database or an app uses more, so watch the Graphs tab: the RAM limit is hard, with no swap.
- All sites share one server, so a hacked site puts the others at risk. Keep software updated, and run PHP or apps as a separate user for each site if you can.
- All sites share one IPv4 address with other customers. For a site that needs an address of its own, see NAT VPS vs VPS.
Recommended plan: Box for up to 5 sites with www, or Box Plus for more.