SSL configuration for Nginx server with Let’s Encrypt (certbot-auto deprecated)

Recently, with 1.10.0 release, certbot-auto was deprecated. That was an easy way to automatically get and renew certifications from Let’s Encrypt. Now there are different ways to do this task.

First way is to install certbot with snapd. But you can install snapd only on actual OS releases (like “buster” 10.0 for Debian). If you have earlier versions of OS, you can use the second way, which I will explain below. is a script written in Shell language, with no dependencies on python or the official Let’s Encrypt client. It supports ACME protocol and is simple to use for issue, renew and install certificates automatically.


First, get the script:

curl | sh


wget -O - | sh

After installation the script will add a cron job, for certs renew automation.

Get the cert

As we have nginx as our webserver, let’s get our cert for a domain: --issue --nginx -d --webroot /var/www/www-root/data/www/

–nginx command means that will change conf file and adds acme challenge folder in it. This nginx mode is only to issue the cert, it will not change your nginx config files.

You can do it manually and add this code in your domain nginx conf file, in server section:

location ^~ /.well-known/acme-challenge/ {
			allow all;
			root /var/www/www-root/data/www/;

We tell nginx to redirect all requests from /.well-known/acme-challenge/ to defined root path, in which will generate acme challenge file.

There may be a problem on this step, especially if you used old certbot-auto script. I faced a 404 error, when external response couldn’t reach acme challenge file. The problem was in included letsencrypt.conf file, which contained another “/.well-known/acme-challenge/” directive. After deleting this line, I got 200 response with acme challenge.

Anyway, if you see this:

Verify error:Invalid response from

Then you really need to dig into your nginx conf, see if “/.well-known/acme-challenge/some-random-letters” is accessible through web.

Install the cert to Nginx

After the cert is generated, we need to copy certs from ~/ to /etc/nginx/certs/ folder. You can use another folder, if you want. The certs files in ~/ folder are for internal use only, so the copy is a must. --install-cert -d \
--key-file       /etc/nginx/certs/  \
--fullchain-file /etc/nginx/certs/ \
--reloadcmd     "service nginx force-reload" is your key file is your certificate file

Configure nginx conf file

Now its time to configure domain conf file with a new certs. Add this in your server section with 403 port:

server {
	ssl_certificate "/etc/nginx/certs/";
	ssl_certificate_key "/etc/nginx/certs/";

Restart nginx and your are done:

service nginx restart