I have an nginx server with ssl set up using certbot. Someone else set up the server originally. The main files are served at the root of the domain, and there is a node api running on port 4040. The problem is that while the SSL certificate for the root domain works fine (eg. https://example.com/some/path), the SSL certificate for the api is expired (https://example.com:4040/api/route). I didn't even know it was possible to set up SSL this way and after looking over my nginx config, I don't know how it's behaving this way. Here is my nginx config (in /etc/nginx/sites-enabled/default)
server {
root /var/www/myapp/current/dist;
server_name example.com;
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
location / {
try_files $uri $uri/ /index.html;
}
}
server {
if ($host = example.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80 default_server;
listen [::]:80 default_server;
server_name example.com;
return 404; # managed by Certbot
}
Everything was working fine with this setup until the SSL cert being served at the :4040 port expired today. I'd like to get the certificate being served for the root domain to be served for the :4040 port as well, I'm just not sure how.