Accidentally removed Cert

I want to remove this domain mwiki.takylstudios.com
but I did it manually.

I ran this command: rm -r /etc/letsencrypt/live/mwiki.taktylstudios.com

can't start the nginx due to this error: systemd[1]: Starting A high performance web server and a reverse proxy server...
nginx[2264]: nginx: [emerg] cannot load certificate "/etc/letsencrypt/live/mwiki.taktylstudios.com>
nginx[2264]: nginx: configuration file /etc/nginx/nginx.conf test failed
systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
systemd[1]: nginx.service: Failed with result 'exit-code'.
systemd[1]: Failed to start A high performance web server and a reverse proxy s>

My web server is (include version): ubuntu 20.4

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

I don't need that cert anymore that's why I deleted it but
upon researching it should not be manually deleted :frowning:

The contents of the /live/ directory are symlinks to the most recent files in the corresponding /archive/ directory. You can manually recreate the symbolic links.

4 Likes

Hello, there are no files in /etc/letsencrypt/archive.

can you please elaborate on manually recreating the symbolic links?

1 Like

Where did the content of that directory go?

That's of no use if there are no contents in the /archive/ directory. In that case you need to use a backup or, if no backup is available, issue a new certificate.

4 Likes

Please don't do anything like that [ever again].
Whatever you are trying to do, there should be an instruction for certbot to do it for you [correctly].

2 Likes

I mean there's a folder in archive but other domain name not mwiki.takylstudios.com :frowning:

I also tried to issue a new cert with mwiki.takylstudios.com but still same error I got >.<

Yes I will take note of that sir in my life, Thanks!

1 Like

How bout reinstalling the nginx and certbot?

Would you show output of this? We can probably fix the damage

ls -l /etc/letsencrypt/{live,archive,renewal}

And, don't just try to reinstall certbot. It won't help. What you have is an nginx config problem because you deleted files it still requires.

2 Likes

Here sir:

/etc/letsencrypt/archive:
total 4
drwxr-xr-x 2 root root 4096 Sep 10 12:08 staging.taktylstudios.com

/etc/letsencrypt/live:
total 12
-rw-r--r-- 1 root root 740 Feb 8 2022 README
drwxr-xr-x 2 root root 4096 Sep 19 08:12 mwiki.taktylstudios.com
drwxr-xr-x 2 root root 4096 Sep 10 12:08 staging.taktylstudios.com

/etc/letsencrypt/renewal:
total 4
-rw-r--r-- 1 root root 582 Sep 10 12:08 staging.taktylstudios.com.conf

btw I tried to recreate the cert of mwiki.taktylstudios.com

Ok, now please show:

ls -l /etc/letsencrypt/live/mwiki.taktylstudios.com

EDIT:
And also

ls -l /etc/letsencrypt/live/staging.taktylstudios.com
2 Likes

ls -l /etc/letsencrypt/live/mwiki.taktylstudios.com
total 0

Sorry, was too late, also this:

ls -l /etc/letsencrypt/live/staging.taktylstudios.com
2 Likes

ls -l /etc/letsencrypt/live/staging.taktylstudios.com
total 4
-rw-r--r-- 1 root root 692 Feb 8 2022 README
lrwxrwxrwx 1 root root 49 Sep 10 12:08 cert.pem -> ../../archive/staging.taktylstudios.com/cert4.pem
lrwxrwxrwx 1 root root 50 Sep 10 12:08 chain.pem -> ../../archive/staging.taktylstudios.com/chain4.pem
lrwxrwxrwx 1 root root 54 Sep 10 12:08 fullchain.pem -> ../../archive/staging.taktylstudios.com/fullchain4.pem
lrwxrwxrwx 1 root root 52 Sep 10 12:08 privkey.pem -> ../../archive/staging.taktylstudios.com/privkey4.pem

OK, just one more but it's long. Then I can give good advice on what to do.

Please show result of sudo nginx -T (skip sudo if you don't need it). Place 3 backticks before and after the output like
```
output of: sudo nginx -T
```

Or, upload the txt file created by doing sudo nginx -T >upload.txt

2 Likes

sure btw Thanks a lot for your time sir!

nginx: configuration file /etc/nginx/nginx.conf test failed```

[upload.txt|attachment](upload://fprEVGUMf2UMGFJrVQzYCl7p3d.txt) (382 Bytes)

Oh, right, ack. OK, can you upload the nginx.conf file (might have to copy it to .txt file)

1 Like

noted sir

nginx.conf.txt (1.9 KB)

thanks. Give me a minute

3 Likes

show

ls -l /etc/nginx/conf.d/*.conf
ls -l /etc/nginx/sites-enabled
3 Likes