CliError : Failed to restart Nginx , for setup nginx ssl

Hi,
I tried to set up a SSL for a subdomain (www) and redirect to https://mydomain.com.
I followed the documentation
https://ghost.org/docs/ghost-cli/?_ga=2.118653449.1825965484.1682159099-1592938179.1682159099#knowledgebase

I already set an A record for www, pointing to the site host.

After I ran $ ghost setup nginx ssl I got

✖ Setting up SSL
One or more errors occurred.

1) CliError

Message: Failed to restart Nginx.

Debug Information:
    OS: Ubuntu, v22.04.1 LTS
    Node Version: v16.17.0
    Ghost Version: 5.43.0
    Ghost-CLI Version: 1.24.0
    Environment: production
    Command: 'ghost setup nginx ssl'

I checked on /etc/nginx/sites-available and found both .com.conf and .com-ssl.conf for my subdomain that I just configed.
I edited both as instructed .
When I ran sudo nginx-t, I got

nginx: [emerg] cannot load certificate "/etc/letsencrypt/www.mydomain.com/fullchain.cer": BIO_new_file() failed (SSL: error:80000002:system library::No such file or directory:calling fopen(/etc/letsencrypt/www.mydomain.com/fullchain.cer, r) error:10000080:BIO routines::no such file)

I don’t know if I should delete these two new conf for my subdomain and retry ghost setup nginx ssl, or how should I fix this as my site now working only with https://mydomain.com and not with www.

Thank you for your time and support.
Please help!

Issue Fixed…
Thank you.

how did you fix it ?
how did you fix it ?

It failed to restart Nginx because the folder /etc/letsencrypt/www.mydomain.com/ couldn’t be found.
In my case, letsencrypt generated certificate under a folder name www.mydomain.com_ecc instead of www.mydomain.com .
So I went to update the file path in www.mydomain.com-ssl.conf under /etc/nginx/sites-available to

ssl_certificate /etc/letsencrypt/www.mydomain.com_ecc/fullchain.cer;
ssl_certificate_key /etc/letsencrypt/www.mydomain.com_ecc/vanthletic.com.key;

And then $ sudo nginx -t to test and if it works $ sudo nginx -s reload
I have to wait for a minute to successfully reload the nginx as it might need a little time to propagate.

Hope it helps.