docker – How to Update SSL Certificates in Dockerized Nginx, Vite, and Spring Boot Setup After Changing Domain?
I am running an application with Nginx, Vite, and Spring Boot using Docker.
Initially, I used the following command to obtain an SSL certificate for my old domain:
sudo certbot --nginx -d my_old_domain
Recently, I changed my domain.
Consequently, I updated the certificate files (cert, chain, fullchain, privkey) and deleted the old certificate using:
sudo certbot delete --cert-name my_old_domain
Below is a part of my /etc/nginx/conf.d/default.conf file inside the Docker container:
# HTTP to HTTPS redirect
server {
listen 80;
server_name new-domain;
location / {
return 301 https://$host$request_uri;
}
}
# HTTPS server
server {
listen 443 ssl;
server_name address-info.ddns.net;
ssl_certificate /etc/letsencrypt/live/new-domain/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/new-domain/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri /index.html;
}
}
I followed these steps:
- Obtained a new SSL certificate for the new domain.
- Updated the certificate files (cert, chain, fullchain, privkey) in the Docker container.
- Modified the Nginx configuration to use the new certificate files.
- Restarted the Nginx service to apply the changes.
- Cleared cookies and browser cache.
I expected the new domain to be served over HTTPS correctly using the new SSL certificate. However, the old SSL certificate is still being shown instead of the new one.
What might I be missing or what additional steps should I take to resolve this issue?
Thanks in advance for your help!
Read more here: Source link
