I am a noob when it comes to Linux and nginx, so my question maybe as basic as it sounds.
So I have two domains domain1.com and domain2.com both pointing to my server. I have obtained a certificate via letsencrypt for each of the two. How can I install each of those for each of the domains?
I have searched the internet and had no luck. So far I came up with this
Config 1:
server {
server_name domain1.com;
ssl_certificate path/to/cert;
ssl_certificate_key path/to/cert/key;
}
Config two:
server {
server_name domain2.com;
ssl_certificate path/to/cert2;
ssl_certificate_key path/to/cert/key2;
}
The default config:
server {
listen 80 default_server;
listen [::]:80 default_server;
listen 443 ssl default_server;
listen [::]:443 ssl default_server;
root /var/www/html;
}
I have created one for both. One doamin was already configured and works fine. But the second can not reach domain2.com via https:// and also the domain points to the default side.
TL;DR How can I use two certificates for two domains on one nginx instance?
Thanks!
EDIT: All other configs are pretty much the basic ones you get with the installation.