# Completely messed up configuration files

**URL:** <https://community.letsencrypt.org/t/completely-messed-up-configuration-files/183627>\
**Category:** Help\
**Created:** [August 29, 2022, 7:05pm UTC](https://community.letsencrypt.org/t/completely-messed-up-configuration-files/183627 "2022-08-29T19:05:55Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Genis](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/genis/32/63398_2.png) [@Genis](https://community.letsencrypt.org/u/Genis)\
**Post date:** [August 29, 2022, 7:05pm UTC](https://community.letsencrypt.org/t/completely-messed-up-configuration-files/183627/1 "2022-08-29T19:05:56Z")

</div>

My domain is: [longenyc.com](http://longenyc.com)

I ran this command: A lot of them 😑

It produced this output: It says that I have no certificates (which is not true) and it's unable to renew the certificate

My web server is (include version): NGINX 1.18

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

My hosting provider, if applicable, is: Hostinger

I can login to a root shell on my machine: Yes

I'm using a control panel to manage my site: No

The version of my client is: 0.40.0

Firstly, I created a certificate for both [longenyc.com](http://longenyc.com) and [www.longenyc.com](http://www.longenyc.com). Then, after using Cloudflare to optimize and protect the website, renoval didn't work because of the [www.longenyc.com](http://www.longenyc.com), which works through a redirection.

So, I tried to create a new certificate only for [longenyc.com](http://longenyc.com), without checking before the correct way to do it. So, I had two certificates. I deleted both and created a new one. Then, a problem with the config file appeared and now the whole certbot isn't able of generating new certificates.

As the website is not in production yet, I think the easyest way to procede will be to completely remove everything and install it again.

After failing with previous attempts and not founding on the website how to properly doing... could you help me?

---

<div class="post-metadata">

**Author:** ![Bruce5051](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/bruce5051/32/76576_2.png) [@Bruce5051](https://community.letsencrypt.org/u/Bruce5051)\
**Post date:** [August 29, 2022, 7:10pm UTC](https://community.letsencrypt.org/t/completely-messed-up-configuration-files/183627/2 "2022-08-29T19:10:17Z")

</div>

Keep your certificates and associated Private Keys for

> **[crt.sh | longenyc.com](https://crt.sh/?q=longenyc.com)**
>
> Free CT Log Certificate Search Tool from Sectigo (formerly Comodo CA)

and

> **[crt.sh | www.longenyc.com](https://crt.sh/?q=www.longenyc.com)**
>
> Free CT Log Certificate Search Tool from Sectigo (formerly Comodo CA)

That way you won't have to hit your [Rate Limits - Let's Encrypt](https://letsencrypt.org/docs/rate-limits/)

Also before editing a configuration file safe off a backup copy first.

---

<div class="post-metadata">

**Author:** ![Genis](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/genis/32/63398_2.png) [@Genis](https://community.letsencrypt.org/u/Genis)\
**Post date:** [August 29, 2022, 7:16pm UTC](https://community.letsencrypt.org/t/completely-messed-up-configuration-files/183627/3 "2022-08-29T19:16:50Z")

</div>

Hi, Bruce! Thanks for your answer. I'm not worried about the rate limits. Now, I can not do any backup of the configuration files because they are inexistent, empty or broken. So, I need how to restore everything from certbot, as a fresh install.

---

<div class="post-metadata">

**Author:** ![Osiris](https://avatars.discourse-cdn.com/v4/letter/o/839c29/32.png) [@Osiris](https://community.letsencrypt.org/u/Osiris)\
**Post date:** [August 29, 2022, 7:22pm UTC](https://community.letsencrypt.org/t/completely-messed-up-configuration-files/183627/4 "2022-08-29T19:22:20Z")

</div>

If your webserver is complaining about that it can't find a file that's configured in its configuration file, just point that directive to a certificate that _does_ exist.

---

<div class="post-metadata">

**Author:** ![Genis](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/genis/32/63398_2.png) [@Genis](https://community.letsencrypt.org/u/Genis)\
**Post date:** [August 29, 2022, 7:25pm UTC](https://community.letsencrypt.org/t/completely-messed-up-configuration-files/183627/5 "2022-08-29T19:25:24Z")

</div>

Hi, Osiris! In an attempt to reinstall the configuration file, I deleted it, but I was not able to create a new one automatically. So, now I have no configuration file at all.

---

<div class="post-metadata">

**Author:** ![Osiris](https://avatars.discourse-cdn.com/v4/letter/o/839c29/32.png) [@Osiris](https://community.letsencrypt.org/u/Osiris)\
**Post date:** [August 29, 2022, 7:28pm UTC](https://community.letsencrypt.org/t/completely-messed-up-configuration-files/183627/6 "2022-08-29T19:28:09Z")

</div>

Well, if you don't have your webserver configured at all, then that's probably a good thing to start with. And that doesn't necessarily require a certificate.

Or did you mean a configuration file in Certbot? Because I thought you said you "created a new one", so I don't understand.

To help us help you better, please provide more exact details, so we don't have to guess continually, preferably with **exact** error messages et cetera.

---

<div class="post-metadata">

**Author:** ![Genis](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/genis/32/63398_2.png) [@Genis](https://community.letsencrypt.org/u/Genis)\
**Post date:** [August 29, 2022, 7:37pm UTC](https://community.letsencrypt.org/t/completely-messed-up-configuration-files/183627/7 "2022-08-29T19:37:24Z")

</div>

My webserver is configured correctly, but not the file that certbot uses for the renewal.

When I run `sudo certbot renew --dry-run`:  
the result is:

```nohighlight
Saving debug log to /var/log/letsencrypt/letsencrypt.log
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
** DRY RUN: simulating 'certbot renew' close to cert expiry
** (The test certificates below have not been saved.)
No renewals were attempted.
** DRY RUN: simulating 'certbot renew' close to cert expiry
** (The test certificates above have not been saved.)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

```

Now, I execute `sudo certbot`:

```nohighlight
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx
Which names would you like to activate HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: longenyc.com
2: www.longenyc.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): 1
Obtaining a new certificate
archive directory exists for longenyc.com

```

Now, I try `sudo certbot certificates`:

```nohighlight
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Renewal configuration file /etc/letsencrypt/renewal/longenyc.com.conf produced an unexpected error: renewal config file {} is missing a required file reference. Skipping.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
The following renewal configurations were invalid:
  /etc/letsencrypt/renewal/longenyc.com.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

```

Do I need to do more tests?

---

<div class="post-metadata">

**Author:** ![rg305](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/rg305/32/91314_2.png) [@rg305](https://community.letsencrypt.org/u/rg305)\
**Post date:** [August 29, 2022, 7:45pm UTC](https://community.letsencrypt.org/t/completely-messed-up-configuration-files/183627/8 "2022-08-29T19:45:24Z")

</div>

> [@Genis](#):
>
> `file /etc/letsencrypt/renewal/longenyc.com.conf produced an unexpected error`

Let's try to correct that file.  
Please show it.

---

<div class="post-metadata">

**Author:** ![Osiris](https://avatars.discourse-cdn.com/v4/letter/o/839c29/32.png) [@Osiris](https://community.letsencrypt.org/u/Osiris)\
**Post date:** [August 29, 2022, 7:45pm UTC](https://community.letsencrypt.org/t/completely-messed-up-configuration-files/183627/9 "2022-08-29T19:45:33Z")

</div>

Please show the output of:

```nohighlight
sudo ls -lR /etc/letsencrypt/{archive,live}

```

---

<div class="post-metadata">

**Author:** ![Genis](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/genis/32/63398_2.png) [@Genis](https://community.letsencrypt.org/u/Genis)\
**Post date:** [August 29, 2022, 7:47pm UTC](https://community.letsencrypt.org/t/completely-messed-up-configuration-files/183627/10 "2022-08-29T19:47:19Z")

</div>

The output is:

```nohighlight
/etc/letsencrypt/archive:
total 4
drwxr-xr-x 2 root root 4096 ago 24 19:13 longenyc.com

/etc/letsencrypt/live:
total 8
drwxr-xr-x 2 root root 4096 ago 29 02:37 longenyc.com
-rw-r--r-- 1 root root 740 jul 8 21:39 README

```

---

<div class="post-metadata">

**Author:** ![Osiris](https://avatars.discourse-cdn.com/v4/letter/o/839c29/32.png) [@Osiris](https://community.letsencrypt.org/u/Osiris)\
**Post date:** [August 29, 2022, 7:48pm UTC](https://community.letsencrypt.org/t/completely-messed-up-configuration-files/183627/11 "2022-08-29T19:48:09Z")

</div>

I've edited the `-R` option into the command, sorry for the late addition. Could you run the command with the `-R` option and also show the file referenced by Rudy?

---

<div class="post-metadata">

**Author:** ![Genis](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/genis/32/63398_2.png) [@Genis](https://community.letsencrypt.org/u/Genis)\
**Post date:** [August 29, 2022, 7:48pm UTC](https://community.letsencrypt.org/t/completely-messed-up-configuration-files/183627/12 "2022-08-29T19:48:51Z")

</div>

I used the `sudo nano...` command to open it and it is empty:  
 ![Captura de pantalla 2022-08-29 a las 21.47.59](https://global.discourse-cdn.com/letsencrypt/original/3X/2/c/2ca81453fd147d3224ba7b2a8a47f5d0d2bb211f.png)

---

<div class="post-metadata">

**Author:** ![Genis](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/genis/32/63398_2.png) [@Genis](https://community.letsencrypt.org/u/Genis)\
**Post date:** [August 29, 2022, 7:50pm UTC](https://community.letsencrypt.org/t/completely-messed-up-configuration-files/183627/13 "2022-08-29T19:50:42Z")

</div>

> [@Osiris](#):
>
> `sudo ls -lR /etc/letsencrypt/{archive,live}`

This is the new output:

```nohighlight
/etc/letsencrypt/archive:
total 4
drwxr-xr-x 2 root root 4096 ago 24 19:13 longenyc.com

/etc/letsencrypt/archive/longenyc.com:
total 20
-rw-r--r-- 1 root root 1834 ago 24 19:13 cert1.pem
-rw-r--r-- 1 root root 3750 ago 24 19:13 chain1.pem
-rw-r--r-- 1 root root 5584 ago 24 19:13 fullchain1.pem
-rw------- 1 root root 1704 ago 24 19:13 privkey1.pem

/etc/letsencrypt/live:
total 8
drwxr-xr-x 2 root root 4096 ago 29 02:37 longenyc.com
-rw-r--r-- 1 root root 740 jul 8 21:39 README

/etc/letsencrypt/live/longenyc.com:
total 4
lrwxrwxrwx 1 root root 36 ago 24 19:13 cert.pem -> ../../archive/longenyc.com/cert1.pem
lrwxrwxrwx 1 root root 37 ago 24 19:13 chain.pem -> ../../archive/longenyc.com/chain1.pem
lrwxrwxrwx 1 root root 41 ago 24 19:13 fullchain.pem -> ../../archive/longenyc.com/fullchain1.pem
lrwxrwxrwx 1 root root 39 ago 24 19:13 privkey.pem -> ../../archive/longenyc.com/privkey1.pem
-rw-r--r-- 1 root root 692 ago 24 19:13 README

```

---

<div class="post-metadata">

**Author:** ![Osiris](https://avatars.discourse-cdn.com/v4/letter/o/839c29/32.png) [@Osiris](https://community.letsencrypt.org/u/Osiris)\
**Post date:** [August 29, 2022, 7:55pm UTC](https://community.letsencrypt.org/t/completely-messed-up-configuration-files/183627/14 "2022-08-29T19:55:08Z")

</div>

All the actually important files are there. You could perhaps try to restore the configuration file with the contents:

```nohighlight
# renew_before_expiry = 30 days
version = 0.40.0
archive_dir = /etc/letsencrypt/archive/longenyc.com
cert = /etc/letsencrypt/live/longenyc.com/cert.pem
privkey = /etc/letsencrypt/live/longenyc.com/privkey.pem
chain = /etc/letsencrypt/live/longenyc.com/chain.pem
fullchain = /etc/letsencrypt/live/longenyc.com/fullchain.pem

# Options used in the renewal process
[renewalparams]
account = abcdefg
server = https://acme-staging-v02.api.letsencrypt.org/directory

```

where the `abcdefg` needs to be replaced with the hash found by running

`ls /etc/letsencrypt/accounts/acme-v02.api.letsencrypt.org/directory/`.

Not sure if Certbot will accept a configuration file without the authenticator configured, but it's worth a try.

---

<div class="post-metadata">

**Author:** ![Genis](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/genis/32/63398_2.png) [@Genis](https://community.letsencrypt.org/u/Genis)\
**Post date:** [August 29, 2022, 8:00pm UTC](https://community.letsencrypt.org/t/completely-messed-up-configuration-files/183627/15 "2022-08-29T20:00:05Z")

</div>

Ok! I followed your instructions and attempted again with `sudo certbot renew --dry-run`:

```nohighlight
Saving debug log to /var/log/letsencrypt/letsencrypt.log

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/longenyc.com.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Renewal configuration file /etc/letsencrypt/renewal/longenyc.com.conf does not specify an authenticator. Skipping.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
** DRY RUN: simulating 'certbot renew' close to cert expiry
** (The test certificates below have not been saved.)

No renewals were attempted.

Additionally, the following renewal configurations were invalid: 
  /etc/letsencrypt/renewal/longenyc.com.conf (parsefail)
** DRY RUN: simulating 'certbot renew' close to cert expiry
** (The test certificates above have not been saved.)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
0 renew failure(s), 1 parse failure(s)

```

Looks better, but still does not completely work...

---

<div class="post-metadata">

**Author:** ![Genis](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/genis/32/63398_2.png) [@Genis](https://community.letsencrypt.org/u/Genis)\
**Post date:** [August 29, 2022, 8:01pm UTC](https://community.letsencrypt.org/t/completely-messed-up-configuration-files/183627/16 "2022-08-29T20:01:16Z")

</div>

Oh, I guess I need to add the "1" to the file names, I'm going to try.

Edit:

I changed:

```nohighlight
cert = /etc/letsencrypt/live/longenyc.com/cert.pem
privkey = /etc/letsencrypt/live/longenyc.com/privkey.pem
chain = /etc/letsencrypt/live/longenyc.com/chain.pem
fullchain = /etc/letsencrypt/live/longenyc.com/fullchain.pem

```

by:

```nohighlight
cert = /etc/letsencrypt/live/longenyc.com/cert1.pem
privkey = /etc/letsencrypt/live/longenyc.com/privkey1.pem
chain = /etc/letsencrypt/live/longenyc.com/chain1.pem
fullchain = /etc/letsencrypt/live/longenyc.com/fullchain1.pem

```

Runned `sudo certbot renew --dry-run` again:

```nohighlight
Saving debug log to /var/log/letsencrypt/letsencrypt.log

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/longenyc.com.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/certbot/renewal.py", line 65, in _reconstitute
    renewal_candidate = storage.RenewableCert(full_path, config)
  File "/usr/lib/python3/dist-packages/certbot/storage.py", line 465, in __init__
    self._check_symlinks()
  File "/usr/lib/python3/dist-packages/certbot/storage.py", line 522, in _check_symlinks
    raise errors.CertStorageError(
certbot.errors.CertStorageError: expected /etc/letsencrypt/live/longenyc.com/cert1.pem to be a symlink
Renewal configuration file /etc/letsencrypt/renewal/longenyc.com.conf is broken. Skipping.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
** DRY RUN: simulating 'certbot renew' close to cert expiry
** (The test certificates below have not been saved.)

No renewals were attempted.

Additionally, the following renewal configurations were invalid: 
  /etc/letsencrypt/renewal/longenyc.com.conf (parsefail)
** DRY RUN: simulating 'certbot renew' close to cert expiry
** (The test certificates above have not been saved.)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
0 renew failure(s), 1 parse failure(s)

```

---

<div class="post-metadata">

**Author:** ![Osiris](https://avatars.discourse-cdn.com/v4/letter/o/839c29/32.png) [@Osiris](https://community.letsencrypt.org/u/Osiris)\
**Post date:** [August 29, 2022, 8:04pm UTC](https://community.letsencrypt.org/t/completely-messed-up-configuration-files/183627/17 "2022-08-29T20:04:05Z")

</div>

> [@Genis](#):
>
> Oh, I guess I need to add the "1" to the file names

No, you don't. The "1"s are for in the archive directory only, the live directory symlinks to the archive directory and does NOT use suffixes. Please don't mess up the configuration file again.

The error comes from the thing I was worried about, Certbot requires an authenticator configured. Do you remember what authenticator plugin you've used previously? The easiest way would be to use the `nginx` authenticator by appending `authenticator = nginx` to the bottom of the configuration file.

---

<div class="post-metadata">

**Author:** ![Genis](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/genis/32/63398_2.png) [@Genis](https://community.letsencrypt.org/u/Genis)\
**Post date:** [August 29, 2022, 8:05pm UTC](https://community.letsencrypt.org/t/completely-messed-up-configuration-files/183627/18 "2022-08-29T20:05:13Z")

</div>

> [@Osiris](#):
>
> authenticator = nginx

I'm so grateful 😭 you are real cracks! Thank you very much, sorry for messing up the configuration file.

The file content:

```nohighlight
# renew_before_expiry = 30 days
version = 0.40.0
archive_dir = /etc/letsencrypt/archive/longenyc.com
cert = /etc/letsencrypt/live/longenyc.com/cert.pem
privkey = /etc/letsencrypt/live/longenyc.com/privkey.pem
chain = /etc/letsencrypt/live/longenyc.com/chain.pem
fullchain = /etc/letsencrypt/live/longenyc.com/fullchain.pem

# Options used in the renewal process
[renewalparams]
account =
server = https://acme-staging-v02.api.letsencrypt.org/directory

authenticator = nginx

```

The result of sudo `certbot renew --dry-run`:

```nohighlight
Saving debug log to /var/log/letsencrypt/letsencrypt.log

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/longenyc.com.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cert not due for renewal, but simulating renewal for dry run
Plugins selected: Authenticator nginx, Installer None
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for longenyc.com
Waiting for verification...
Cleaning up challenges

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
new certificate deployed without reload, fullchain is
/etc/letsencrypt/live/longenyc.com/fullchain.pem
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
** DRY RUN: simulating 'certbot renew' close to cert expiry
** (The test certificates below have not been saved.)

Congratulations, all renewals succeeded. The following certs have been renewed:
  /etc/letsencrypt/live/longenyc.com/fullchain.pem (success)
** DRY RUN: simulating 'certbot renew' close to cert expiry
** (The test certificates above have not been saved.)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

```

---

<div class="post-metadata">

**Author:** ![Osiris](https://avatars.discourse-cdn.com/v4/letter/o/839c29/32.png) [@Osiris](https://community.letsencrypt.org/u/Osiris)\
**Post date:** [August 29, 2022, 8:17pm UTC](https://community.letsencrypt.org/t/completely-messed-up-configuration-files/183627/19 "2022-08-29T20:17:36Z")

</div>

Great you've got it working again!

In the future, either be more careful or backup the files before destroying them 😉

---

<div class="post-metadata">

**Author:** ![rg305](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/rg305/32/91314_2.png) [@rg305](https://community.letsencrypt.org/u/rg305)\
**Post date:** [August 29, 2022, 8:45pm UTC](https://community.letsencrypt.org/t/completely-messed-up-configuration-files/183627/20 "2022-08-29T20:45:18Z")

</div>

What's the _fun in that_? - LOL  
I say:

> **[Destroy Build Destroy](https://en.wikipedia.org/wiki/Destroy_Build_Destroy)**
>
> Destroy Build Destroy is an American live action reality series on Cartoon Network hosted by Andrew W.K. It was a game show, in which two teams destroyed a random object and built vehicles from it, and then the winners destroyed the losers' creation. The series originally premiered as part of a line of live-action reality series called CN Real, which aired in 2009. The series premiered on June 20, 2009, and ended its run on September 21, 2011.
> Destroy Build Destroy is one of only two shows fro...

[much more fun!]

[Next page](https://community.letsencrypt.org/t/completely-messed-up-configuration-files/183627.md?page=2)
