Secure Multiple Websites on One Server
Running several websites on one server is common, and HTTPS handles it well. The server needs a separate configuration block for each site, a certificate that covers each site's names and a way to renew them all. A single IP address is enough, thanks to Server Name Indication (SNI).
Multiple websites on one server: the approaches
| Approach | How it works | Good for | Downside |
|---|---|---|---|
| One certificate per site | Each domain has its own certificate | Unrelated sites, different owners | More certificates to track |
| One multi-name (SAN) certificate | One certificate lists many names | A few related sites | One failure affects all names |
| Wildcard certificate | Covers *.example.com | Many subdomains of one domain | Needs DNS-01, not for different domains |
| Reverse proxy with automatic certificates | The proxy issues certificates itself | Container setups | Depends on that proxy |
For unrelated sites, one certificate each is the cleanest. A problem on one domain cannot block the others, and private keys stay separate. See free SSL for multiple domains for the multi-name option.
Step 1: Point DNS at the server
Each domain and www name needs an A record, and an AAAA record if the server has IPv6. Check them before requesting certificates, since a wrong record is the leading cause of failed validation.
Multiple websites on one server, step 2: virtual hosts
Create one server block per site in Nginx. SNI picks the right block by name:
server {
listen 443 ssl;
server_name site-a.example www.site-a.example;
root /var/www/site-a;
ssl_certificate
/etc/letsencrypt/live/site-a.example/fullchain.pem;
ssl_certificate_key
/etc/letsencrypt/live/site-a.example/privkey.pem;
}Copy the block for each further site and change the names and paths. Add a port 80 block per site that redirects to HTTPS while still allowing the challenge path.
Step 3: Issue the certificates
sudo certbot --nginx -d site-a.example -d www.site-a.example
sudo certbot --nginx -d site-b.example -d www.site-b.example
sudo certbot certificatesThe last command lists every certificate, its names and its expiry, which gives you a handy inventory.
Step 4: Set a default server
Requests with an unknown name still get a certificate. Make that a deliberate choice by adding a default server that rejects the connection or serves a neutral page, so visitors to the bare IP do not see one of your real sites. Learn how SNI chooses in the guide Fix SSL on Nginx Proxy Manager and Caddy if a proxy sits in front.
Step 5: Renewal and reload
One client covers all sites. Certbot renews each certificate on its own schedule, and one deploy hook reloads Nginx after any renewal:
sudo certbot renew --deploy-hook "systemctl reload nginx"
sudo certbot renew --dry-runSee how to automate SSL renewal with Certbot for setting the timer.
Security and isolation
- Keep private keys readable only by root and the service that needs them.
- Do not share one key across unrelated sites.
- Limit the server to modern TLS versions and use the same hardened settings for each site in an included file.
- Run web applications under separate users where you can, so one compromised site does not expose the others.
See how to protect SSL private keys for storage advice.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| Browser shows another site's certificate | No server block for that name | Add the name to the right block |
| Renewal fails for only one site | DNS or redirect problem on that domain | Test its challenge path and records |
| New site works over HTTP but not HTTPS | Certificate not yet issued | Run Certbot for the new names |
| Old certificate still served | Server not reloaded | Reload Nginx or Apache |
When to use a wildcard or multi-name certificate
If the sites are all subdomains of one domain, such as app.example.com and docs.example.com, a wildcard certificate reduces the number of certificates to manage. It requires a DNS challenge, and the same key then protects every subdomain, so guard it well. See how to get a free wildcard certificate. For unrelated domains, a wildcard cannot help, and separate certificates are the right choice.
Key takeaways
- SNI lets many HTTPS sites share one IP address.
- Give each unrelated site its own certificate and virtual host.
- Use one ACME client with one reload hook for renewals.
- Keep an inventory with
certbot certificatesand monitor expiry from outside.
Related reading: the SAN certificate, monitoring many certificates and free SSL on nginx.
Frequently Asked Questions
Can several sites share one IP address?
Yes. Server Name Indication lets the server pick a certificate from the hostname the client asked for, and every current browser supports it.
One certificate per site, or one for all?
One per name is simplest and keeps private keys apart, so a problem on one domain cannot block the others. A wildcard or multi-name certificate works when the sites are related.
How do I renew them all?
One ACME client with a deploy hook that reloads the web server. Certbot renews every certificate it issued in a single run, then runs the hook once.
✅ Post-Installation Verification & SEO Checklist
After applying the steps above, run through this 5-point checklist to prevent browser warnings and protect your Google SEO rankings:
- Verify full CA chain trust and TLS 1.3 support using our Live SSL Checker.
- Scan for Mixed Content HTTP links and check HSTS/CSP headers on Security Headers Checker.
- Enforce a permanent 301 HTTP-to-HTTPS redirect with our HTTPS Redirect Generator.
- Confirm both root and
wwwversions resolve cleanly to one canonical HTTPS URL. - Verify your HTTPS property and
sitemap.xmlinside Google Search Console and Bing Webmaster Tools.