Letsencrypt doesn't create fullchain.pem | Your time & help appreciated 👍

Please fill out the fields below so we can help you better. Note: you must provide your domain name to get help. Domain names for issued certificates are all made public in Certificate Transparency logs (e.g. crt.sh | example.com), so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.

My domain is:4digitalconsulting.com an I was trying to add the 4th domain to the same VPS but I got error that nginx can't find /etc/letsencrypt/live/eltogary.com/fullchain.pem So I deleted the certs and Now I lost in the Documentation :smiley: Can you help me?

I ran this command:
sudo certbot certificates
sudo certbot delete
sudo certbot certonly --nginx
sudo certbot --nginx
sudo certbot renew --dry-run
nginx -T

It produced this output:
nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)
2024/06/19 07:27:11 [warn] 128206#128206: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:1
2024/06/19 07:27:11 [emerg] 128206#128206: cannot load certificate "/etc/letsencrypt/live/4digitalconsulting.com/fullchain.pem": BIO_new_file() failed (SSL: error:8000000D:system library::Permission denied:calling fopen(/etc/letsencrypt/live/4digitalconsulting.com/fullchain.pem, r) error:10080002:BIO routines::system lib)
nginx: configuration file /etc/nginx/nginx.conf test failed

My web server is (include version): nginx/1.18.0 (Ubuntu)

The operating system my web server runs on is (include version): Ubuntu 22.04.4 LTS

My hosting provider, if applicable, is: VPS from Vultr

I can login to a root shell on my machine (yes or no, or I don't know): Yes for now

I'm using a control panel to manage my site (no, or provide the name and version of the control panel): no I work on Cmder

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot): I already removed it

Well, there's your problem. Why would you do that? Now you're in trouble.

Nginx expects a file which you've deleted. So either retrieve the file again from a recent backup or reconfigure nginx so it doesn't expect a deleted file.

Also, you probably want to run nginx -T as root too (e.g. also use sudo).

2 Likes

Thanks for your reply.

I'm just learning by doing & having some fun (problems :grin:).

How can I do that backup in the future and what are those files for the nginx?
Do you mean a whole server backup or copying nginx files only?

Where is that file and how can I configure it successfully?
BTW the nginx.conf has the same configration as I configured it!

nginx: [emerg] cannot load certificate "/etc/letsencrypt/live/4digitalconsulting.com/fullchain.pem": BIO_new_file() failed (SSL: error:80000002:system library::No such file or directory:calling fopen(/etc/letsencrypt/live/4digitalconsulting.com/fullchain.pem, r) error:10000080:BIO routines::no such file)
nginx: configuration file /etc/nginx/nginx.conf test failed

That message was the same when I tested nginx for eltogary.com but with /etc/letsencrypt/live/eltogary.com/fullchain.pem
,So why letsencrypt/ doesn't make that .pem file for eltogary.com?? it was working fine for the other sites!

Have a nice day.

1 Like

Sure, exploring new things is fun. Below is a topic explaining how to safely remove certs from an active system. And, what you can do to recover if you didn't do that.

https://eff-certbot.readthedocs.io/en/latest/using.html#safely-deleting-certificates

Becoming your own nginx server admin has a substantial learning curve. You should spend some more time with the nginx docs to become comfortable with its config files and the purpose of server blocks.

Ubuntu has some nice docs. And https://nginx.org

https://ubuntu.com/tutorials/install-and-configure-nginx#1-overview

https://nginx.org/en/docs/beginners_guide.html

6 Likes

Thanks Mike.

I did those steps in

https://eff-certbot.readthedocs.io/en/latest/using.html#safely-deleting-certificates

but when I do => sudo nginx -t
I got => nginx: [emerg] cannot load certificate "/etc/letsencrypt/live/4digitalconsulting.com/fullchain.pem": BIO_new_file() failed (SSL: error:80000002:system library::No such file or directory:calling fopen(/etc/letsencrypt/live/4digitalconsulting.com/fullchain.pem, r) error:10000080:BIO routines::no such file)
nginx: configuration file /etc/nginx/nginx.conf test failed

I'm thinking about restart nginx anyway and see what will happen before I destroy the server and start from scratch again.
What do you think?

1 Like

I think you must have missed a step :slight_smile:

You must still have a reference to a non-existing file.

I don't know why you would destroy the server just by correcting a faulty nginx config. I am pretty sure nginx will not start if it fails the -t

Maybe try this to locate it:

sudo grep -R ssl_certificate /etc/nginx/*
3 Likes

In the /etc/nginx/sites-available I opened 4digitalconsulting.com.conf then commented out
# include /etc/nginx/ssl/ssl_4digitalconsulting.com.conf;

then did => sudo nginx -t
I got => nginx: [emerg] cannot load certificate "/etc/letsencrypt/live/self-signed-cert.pem": BIO_new_file() failed (SSL: error:80000002:system library::No such file or directory:calling fopen(/etc/letsencrypt/live/self-signed-cert.pem, r) error:10000080:BIO routines::no such file)
nginx: configuration file /etc/nginx/nginx.conf test failed

Then => sudo grep -R ssl_certificate /etc/nginx/*
I got => /etc/nginx/sites-available/tutrecipes.com.conf: ssl_certificate /etc/letsencrypt/live/self-signed-cert.pem; # managed by Certbot
/etc/nginx/sites-available/tutrecipes.com.conf: ssl_certificate_key /etc/letsencrypt/live/self-signed-privkey.pem; # managed by Certbot
/etc/nginx/sites-available/4digitalconsulting.com.conf: ssl_certificate /etc/letsencrypt/live/self-signed-cert.pem; # managed by Certbot
/etc/nginx/sites-available/4digitalconsulting.com.conf: ssl_certificate_key /etc/letsencrypt/live/self-signed-privkey.pem; # managed by Certbot
/etc/nginx/sites-available/premierconsultancy.net.conf: ssl_certificate /etc/letsencrypt/live/self-signed-cert.pem; # managed by Certbot
/etc/nginx/sites-available/premierconsultancy.net.conf: ssl_certificate_key /etc/letsencrypt/live/self-signed-privkey.pem; # managed by Certbot
/etc/nginx/sites-available/digitalpixelmall.com.conf: ssl_certificate /etc/letsencrypt/live/self-signed-cert.pem; # managed by Certbot
/etc/nginx/sites-available/digitalpixelmall.com.conf: ssl_certificate_key /etc/letsencrypt/live/self-signed-privkey.pem; # managed by Certbot
/etc/nginx/sites-available/eltogary.com.conf: ssl_certificate /etc/letsencrypt/live/self-signed-cert.pem; # managed by Certbot
/etc/nginx/sites-available/eltogary.com.conf: ssl_certificate_key /etc/letsencrypt/live/self-signed-privkey.pem; # managed by Certbot
/etc/nginx/sites-available/fitnesshorus.com.conf: ssl_certificate /etc/letsencrypt/live/self-signed-cert.pem; # managed by Certbot
/etc/nginx/sites-available/fitnesshorus.com.conf: ssl_certificate_key /etc/letsencrypt/live/self-signed-privkey.pem; # managed by Certbot
/etc/nginx/sites-enabled/tutrecipes.com.conf: ssl_certificate /etc/letsencrypt/live/self-signed-cert.pem; # managed by Certbot
/etc/nginx/sites-enabled/tutrecipes.com.conf: ssl_certificate_key /etc/letsencrypt/live/self-signed-privkey.pem; # managed by Certbot
/etc/nginx/sites-enabled/4digitalconsulting.com.conf: ssl_certificate /etc/letsencrypt/live/self-signed-cert.pem; # managed by Certbot
/etc/nginx/sites-enabled/4digitalconsulting.com.conf: ssl_certificate_key /etc/letsencrypt/live/self-signed-privkey.pem; # managed by Certbot
/etc/nginx/sites-enabled/premierconsultancy.net.conf: ssl_certificate /etc/letsencrypt/live/self-signed-cert.pem; # managed by Certbot
/etc/nginx/sites-enabled/premierconsultancy.net.conf: ssl_certificate_key /etc/letsencrypt/live/self-signed-privkey.pem; # managed by Certbot
/etc/nginx/sites-enabled/digitalpixelmall.com.conf: ssl_certificate /etc/letsencrypt/live/self-signed-cert.pem; # managed by Certbot
/etc/nginx/sites-enabled/digitalpixelmall.com.conf: ssl_certificate_key /etc/letsencrypt/live/self-signed-privkey.pem; # managed by Certbot
/etc/nginx/sites-enabled/eltogary.com.conf: ssl_certificate /etc/letsencrypt/live/self-signed-cert.pem; # managed by Certbot
/etc/nginx/sites-enabled/eltogary.com.conf: ssl_certificate_key /etc/letsencrypt/live/self-signed-privkey.pem; # managed by Certbot
/etc/nginx/sites-enabled/fitnesshorus.com.conf: ssl_certificate /etc/letsencrypt/live/self-signed-cert.pem; # managed by Certbot
/etc/nginx/sites-enabled/fitnesshorus.com.conf: ssl_certificate_key /etc/letsencrypt/live/self-signed-privkey.pem; # managed by Certbot
/etc/nginx/snippets/snakeoil.conf:ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem;
/etc/nginx/snippets/snakeoil.conf:ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key;
/etc/nginx/ssl/ssl_tutrecipes.com.conf:ssl_certificate /etc/letsencrypt/live/tutrecipes.com/fullchain.pem;
/etc/nginx/ssl/ssl_tutrecipes.com.conf:ssl_certificate_key /etc/letsencrypt/live/tutrecipes.com/privkey.pem;
/etc/nginx/ssl/ssl_premierconsultancy.net.conf:ssl_certificate /etc/letsencrypt/live/premierconsultancy.net/fullchain.pem;
/etc/nginx/ssl/ssl_premierconsultancy.net.conf:ssl_certificate_key /etc/letsencrypt/live/premierconsultancy.net/privkey.pem;
/etc/nginx/ssl/ssl_eltogary.com.conf:ssl_certificate /etc/letsencrypt/live/eltogary.com/fullchain.pem;
/etc/nginx/ssl/ssl_eltogary.com.conf:ssl_certificate_key /etc/letsencrypt/live/eltogary.com/privkey.pem;
/etc/nginx/ssl/ssl_digitalpixelmall.com.conf:ssl_certificate /etc/letsencrypt/live/digitalpixelmall.com/fullchain.pem;
/etc/nginx/ssl/ssl_digitalpixelmall.com.conf:ssl_certificate_key /etc/letsencrypt/live/digitalpixelmall.com/privkey.pem;
/etc/nginx/ssl/ssl_fitnesshorus.com.conf:ssl_certificate /etc/letsencrypt/live/fitnesshorus.com/fullchain.pem;
/etc/nginx/ssl/ssl_fitnesshorus.com.conf:ssl_certificate_key /etc/letsencrypt/live/fitnesshorus.com/privkey.pem;
/etc/nginx/ssl/ssl_4digitalconsulting.com.conf:ssl_certificate /etc/letsencrypt/live/4digitalconsulting.com/fullchain.pem;
/etc/nginx/ssl/ssl_4digitalconsulting.com.conf:ssl_certificate_key /etc/letsencrypt/live/4digitalconsulting.com/privkey.pem;

Thanks again for your help, really appreciate it.

1 Like

Did you make that file? That was step 2 of the "Safely Deleting ..." section of the docs I linked to.

Because your nginx can't find it. Or does not have permission to read it.

2 Likes

yes i did as the documentation said and it's on the /etc/letsencrypt/ Not on /etc/letsencrypt/live/
live dir is empty.

Should I add it as Include in the server blocks?

I run => sudo ls -l /etc/letsencrypt/
I got => drwx------ 4 root root 4096 Nov 8 2023 accounts
drwx------ 2 root root 4096 Jun 19 07:20 archive
drwx------ 2 root root 4096 Jun 19 07:20 live
-rw-r--r-- 1 root root 774 Nov 8 2023 options-ssl-nginx.conf
drwxr-xr-x 2 root root 4096 Jun 19 07:20 renewal
drwxr-xr-x 5 root root 4096 Nov 8 2023 renewal-hooks
-rw-r--r-- 1 root root 1245 Jun 19 23:45 self-signed-cert.pem
-rw------- 1 root root 1704 Jun 19 23:45 self-signed-privkey.pem
-rw-r--r-- 1 root root 424 Nov 8 2023 ssl-dhparams.pem

I didn't change the Owner or the Permissions since I created the server in the letsencrypt/ dir.

But, step #3 said to make your ssl_certificate lines look like below.

SSLCertificateFile /etc/letsencrypt/self-signed-cert.pem
SSLCertificateKeyFile /etc/letsencrypt/self-signed-privkey.pem
3 Likes

I did that and changed them in the nginx conf files :+1:
Did I miss something?

So you changed the ones above to be like shown in the docs?

Did the nginx -t work?

3 Likes

Not yet Mike
I still have =>
nginx: [warn] "ssl_stapling" ignored, issuer certificate not found for certificate "/etc/letsencrypt/self-signed-cert.pem"
nginx: [warn] "ssl_stapling" ignored, issuer certificate not found for certificate "/etc/letsencrypt/self-signed-cert.pem"
nginx: [emerg] cannot load certificate "/etc/letsencrypt/live/self-signed-cert.pem": BIO_new_file() failed (SSL: error:80000002:system library::No such file or directory:calling fopen(/etc/letsencrypt/live/self-signed-cert.pem, r) error:10000080:BIO routines::no such file)
nginx: configuration file /etc/nginx/nginx.conf test failed

Should I turn off the SSL stapling (OCSP stapling)?

UPDATE

I changed all the conf files for all sites then tested nginx and I got

nginx: [warn] "ssl_stapling" ignored, issuer certificate not found for certificate "/etc/letsencrypt/self-signed-cert.pem"
nginx: [warn] "ssl_stapling" ignored, issuer certificate not found for certificate "/etc/letsencrypt/self-signed-cert.pem"
nginx: [warn] "ssl_stapling" ignored, issuer certificate not found for certificate "/etc/letsencrypt/self-signed-cert.pem"
nginx: [warn] "ssl_stapling" ignored, issuer certificate not found for certificate "/etc/letsencrypt/self-signed-cert.pem"
nginx: [warn] "ssl_stapling" ignored, issuer certificate not found for certificate "/etc/letsencrypt/self-signed-cert.pem"
nginx: [warn] "ssl_stapling" ignored, issuer certificate not found for certificate "/etc/letsencrypt/self-signed-cert.pem"
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Thanks @MikeMcQ we achieved something :muscle:
now should I turn off the SSL stapling before restarting or go ahead and restart?

Stapling should be left to professionals :slight_smile:

I, along with most others helping here, are unpaid volunteers offering our time and expertise for free. It would be helpful if you studied the docs better and did more on your own. You really should understand the error messages about missing files by now - don't you think?

Perhaps some other volunteer will be willing to help further. I'm going to take a break from this thread for awhile.

3 Likes

Sure Mike,

I wanted to take a moment to thank you for all your help with my problems. Your expertise and the time you've dedicated are truly appreciated, especially considering that you, like most others here, are an unpaid volunteer. I understand the importance of studying the documentation better and putting in more effort to solve issues on my own, as you mentioned.

Your advice about stapling and the error messages has been valuable, and I will make sure to work on understanding these aspects better. I respect your decision to take a break from this thread, and I hope to continue improving with the knowledge you've shared.

Thanks again for your support and guidance.
Have a nice day.

1 Like

Why are you trying to load the cert from the live directory?
You show the file in the letsencrypt directory:

2 Likes

Hi Rudy,

I already removed the live/ , restarted Nginx, and installed the new certs successfully.

Now I learned from the other Help tickets here that I should install separate certificates for each domain as the best practice?

As I understand all my certs are in

ssl_certificate /etc/letsencrypt/live/4digitalconsulting.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/4digitalconsulting.com/privkey.pem; # managed by Certbot

How can I make each domain separate (as I did with the Deprecated certbot)?
Can you guide me with it?

Regards,

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