Certificate is renewed but connection shows as not secure till you restart nginx

My domain is: www.setmytest.com

I ran this command:
certbot certificates
It produced this output:
The certbot cerificate was valid as show in the image below.

However, the website was showing as not secure.
After this I ran :
sudo systemctl restart nginx
Then the website became secure.

What can I do so that I do not need to restart nginx everytime the certificate renews?

I can login to a root shell on my machine (yes or no, or I don't know): yes
I am using Nginx 1.14.0 on ubuntu 18.04.5
The version of my client is : certbot 0.31.0

When using certbot certonly to create a certificate, it's usually desirable to include deploy hook as part of the original command:

--deploy-hook "systemctl reload nginx"

If you want this change to affect all your current and future certificates, you could add this line to /etc/letsencrypt/cli.ini:

 deploy-hook = systemctl reload nginx

or add an executable script to the /etc/letsencrypt/renewal-hooks/deploy/ directory which reloads nginx.

To make this change just for this one certificate, you could forcefully renew the certificate now (just once) and it will reload nginx on every subsequent renewal:

certbot renew --cert-name setmytest.com --deploy-hook "systemctl reload nginx" --force-renewal

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.