Unable to renew Lets Encrypt certificate

If using vi, start with:
vi /etc/nginx/sites-enabled/01-hp_wfx

within the editor, use the arrows to find your way to the /worldfixer.com
placing yourself at the "w", press the "i" [to insert]
type:
"www."
press ESC [to exit from inserting]
do the same on both lines
When all looks correct, press ESC then ":wq" and ENTER
[that last ESC is just for good measure]

NOTE: Isn't a forum for "how to use a text editor"
But we continue to go above and beyond...

3 Likes

Yes, super appreciative of the guidance. Way above and beyond the call of duty.

So I did all of that and got this:
root@wfx-prod:~# nginx -T

nginx: [emerg] BIO_new_file("/etc/letsencrypt/live/worldfixer.com/fullchain.pem") failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/etc/letsencrypt/live/worldfixer.com/fullchain.pem','r') error:2006D080:BIO routines:BIO_new_file:no such file)
nginx: configuration file /etc/nginx/nginx.conf test failed
1 Like

Well... Then the edit didn't save the changes.
That's the exact same error message [with the missing "www."]

3 Likes

OR

Let's have a look at the way included files are being matched, with:
grep -i include /etc/nginx/*

3 Likes

No, I think it did as I did the command cat /etc/nginx/sites-enabled/01-hp_wfx again and it showed the lines with www in front.

Here's the one you requested:
root@wfx-prod:~# grep -i include /etc/nginx/*

grep: /etc/nginx/conf.d: Is a directory
grep: /etc/nginx/modules-available: Is a directory
grep: /etc/nginx/modules-enabled: Is a directory
/etc/nginx/nginx.conf:include /etc/nginx/modules-enabled/*.conf;
/etc/nginx/nginx.conf:  include /etc/nginx/mime.types;
/etc/nginx/nginx.conf:  include /etc/nginx/conf.d/*.conf;
/etc/nginx/nginx.conf:  include /etc/nginx/sites-enabled/*;
grep: /etc/nginx/sites-available: Is a directory
grep: /etc/nginx/sites-enabled: Is a directory
grep: /etc/nginx/snippets: Is a directory
1 Like

Here is that culprit:

That would include both of these files:
[as well as every other file in that folder]

I'd move the .save files elsewhere.

3 Likes

Ok, to clarify that I understand, essentially within the data via the command: sudo grep -R worldfixer.com /etc/nginx

I get these

/etc/nginx/sites-enabled/01-hp_wfx.save:    server_name beta.worldfixer.com worldfixer.com www.worldfixer.com 134.122.77.70;
/etc/nginx/sites-enabled/01-hp_wfx.save:    ssl_certificate /etc/letsencrypt/live/worldfixer.com/fullchain.pem; # managed by Certbot
/etc/nginx/sites-enabled/01-hp_wfx.save:    ssl_certificate_key /etc/letsencrypt/live/worldfixer.com/privkey.pem; # managed by Certbot
/etc/nginx/sites-enabled/01-hp_wfx.save:    if ($host = worldfixer.com) {
/etc/nginx/sites-enabled/01-hp_wfx.save:    if ($host = www.worldfixer.com) {
/etc/nginx/sites-enabled/01-hp_wfx.save:    server_name beta.worldfixer.com worldfixer.com www.worldfixer.com;

and these:

/etc/nginx/sites-enabled/01-hp_wfx:    ssl_certificate /etc/letsencrypt/live/worldfixer.com/fullchain.pem; # managed by Certbot
/etc/nginx/sites-enabled/01-hp_wfx:    ssl_certificate_key /etc/letsencrypt/live/worldfixer.com/privkey.pem; # managed by Certbot
/etc/nginx/sites-enabled/01-hp_wfx:    if ($host = worldfixer.com) {
/etc/nginx/sites-enabled/01-hp_wfx:    if ($host = www.worldfixer.com) {
/etc/nginx/sites-enabled/01-hp_wfx:    server_name beta.worldfixer.com worldfixer.com www.worldfixer.com;

This is essentially due to the previous duplication of Let's Encrypt certificates.

So I could 'move' these lines

/etc/nginx/sites-enabled/01-hp_wfx.save:    server_name beta.worldfixer.com worldfixer.com www.worldfixer.com 134.122.77.70;
/etc/nginx/sites-enabled/01-hp_wfx.save:    ssl_certificate /etc/letsencrypt/live/worldfixer.com/fullchain.pem; # managed by Certbot
/etc/nginx/sites-enabled/01-hp_wfx.save:    ssl_certificate_key /etc/letsencrypt/live/worldfixer.com/privkey.pem; # managed by Certbot
/etc/nginx/sites-enabled/01-hp_wfx.save:    if ($host = worldfixer.com) {
/etc/nginx/sites-enabled/01-hp_wfx.save:    if ($host = www.worldfixer.com) {
/etc/nginx/sites-enabled/01-hp_wfx.save:    server_name beta.worldfixer.com worldfixer.com www.worldfixer.com;

To somewhere else...like delete them from the existing file by editing the file and removing the lines and then saving them on a local file in case we ever need access to them or should I save them under a different command file?

1 Like

Move the entire file.
I'm assuming the .save is being used as a backup/copy of the original.
But since it is in the same path/folder, nginx is using both of them.
You can check my logic with:
nginx -T

3 Likes

So you mean I should move the files that are inside /etc/nginx/sites-enabled/

Including all of the files ending in:
01-hp_wfx.save:
01-hp_wfx:
worldfixer.com.save.1:

right?
/etc/nginx/sites-enabled/
It seems to make most sense to just remove the files 01-hp_wfx.save:
I think they are just duplicate entities and thus irrelevant. Plus I'm not really sure where exactly I'd move them to.

So I'm planning to do this:
Enter:
vi /etc/nginx/sites-enabled/

On the edit page, I get the two options:

01-hp_wfx
01-hp_wfx.save
default@                          --> /etc/nginx/sites-available/default

And then I'll just delete the option: 01-hp_wfx.save

--will I not blow anything up in the Lets Encrypt world? Once the duplication is gone, then hopefully I can just run the 'renew' command get the certification working again, right?

1 Like

Don't try to use vi (a text editor) to delete a file.
If you don't need the .save file, use:
rm /etc/nginx/sites-enabled/01-hp_wfx.save
[which will permanently remove that file]

3 Likes

Brilliant! Removing the .save file definitely worked. Just ran the renew command and it was able to renew our certification and get the site back up and running.

Thanks so much for the patience and handholding on that. Saved me on my Friday

2 Likes

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