Facebook Pixel

How do I get SSL for multiple subdomains?

Run sudo certbot --nginx -d yourdomain.com -d api.yourdomain.com -d admin.yourdomain.com to get one certificate for all domains (SAN certificate). Or run certbot separately for each domain to get individual certificates.

Verify This Answer

Cross-check this information using these trusted sources:

More FAQs in Nginx Server Blocks and Virtual Hosts Hosting Multiple Apps on One Server

Create a server block for each domain or subdomain. Each server block has a different server_name and proxy_pass or root. Enable all with symlinks to sites-enabled, test with nginx -t, and restart. Use certbot to get SSL for all domains.

A server block (also called virtual host) is a configuration section that defines how Nginx handles requests for a specific domain. It includes listen port, server_name, and location blocks for routing. Multiple server blocks allow hosting multiple sites on one server.

Use the upstream directive to define a pool of backend servers (e.g., upstream mybackend { server 127.0.0.1:3000; server 127.0.0.1:3001; }). Then use proxy_pass http://mybackend in the location block. Nginx distributes requests using round-robin by default.

Still have questions?

Browse all our FAQs or reach out to our support team

Want to upskill yourself?

Our courses are taking a Coffee break, but your curiosity shouldn't. Stay engaged with namastedev linkedin, youtube, discord and other resources while you wait.

0
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.