0

My NGINX config has a single server defined, and in server-name I have both my domains listed. However, I'd like to keep their SSL certificates separate if possible. I tried using certbot twice, once for each domain, but it seems certbot changes the server's ssl_certificate path in the NGNIX config to match the second domain and overwrites the first domain. Is there a way around this?

Thanks!

Max
  • 111
  • 1
  • 2
    Use separate server blocks. – Gerald Schneider Oct 06 '21 at 16:52
  • I'd like to have everything in the same server block as possible, as they are supposed to be clones of each other in their functionality. If I were to separate server blocks, is there a way to 'redirect' from one server block to the other without actually doing a redirect that the browser has to follow? – Max Oct 06 '21 at 16:56
  • Unless you have a solid technical reason, why do this? There are advantages to have multiple names in one certificate for closely related domain+subdomains. If you really want separate certificates, you must declare separate servers (server blocks). To the browser, two different domain names are different resources/locations. To go from one to the other in the browser requires a redirect. If you are concerned with Google ranking, do not have two URIs with the same content (cloned websites). This means redirecting from the slave content to the master content (e.g example.com -> www.example.com) – John Hanley Oct 06 '21 at 18:18
  • 1
    You can have two different server blocks including the same configuration by using config file includes via "include conf/my-server-block.conf;". This way you can have different certificates for your different servers, but you are able to maintain your server's configuration in one file. – Jens Bradler Oct 07 '21 at 14:48

0 Answers0