Hi there,
I accidentally removed /etc/letsencrypt directory and now when I am trying to use certbot, it is giving this error:
Error while running nginx -c /etc/nginx/nginx.conf -t.
nginx: [emerg] open() "/etc/letsencrypt/options-ssl-nginx.conf" failed (2: No such file or directory) in /etc/nginx/sites-enabled/default:147
nginx: configuration file /etc/nginx/nginx.conf test failed
I tried reinstalling certbot, but it didn't help.
How can I solve it?
The topic title is: How to recreate /etc/letsencrypt/ directory?
And without a backup, there is no way to recreate it exactly the same.
That leaves only create a new one with all that is needed and use that one instead.
And yet we're now talking about files that are also missing elsewhere...
Things that may seem obvious to us, might not be so obvious to the OP.
My constructive "2 cents" here are:
You might do well by temporarily disabling all HTTPS sites until you have reissued them all new certs.
Then bring them back up as you verify that they are using the new certs and expected files correctly.
OP can't get new certs as long as the paths to the certs are missing, as nginx currently requires them and OP uses the nginx plugin. Getting nginx conf files doesn't change that. Once nginx is working again and OP can get new certs, it will also acquire the now-missing nginx conf files automatically. Thus, manually downloading those nginx conf files from the git repository isn't useful
Sorry @sahsanu, but I am inclined to agree with @rg305 and @Osiris here. After setting up an unsecure, working nginx configuration, Martin should be in the same situation as any new certbot user when it comes to acquiring and installing a certificate. Without the certificates, I see the situation as basically a "start over fresh" scenario.
Now, if Martin needs the basic configuration files for nginx, he could download those. I feel like he'd probably be better off just creating a new instance then either copying its configuration or using it entirely.