Letsencrypt running into 404 error

I’ve used letsencrypt in the past with my other domains but I’m running into a issue this time. I created a new virtual server for a new domain, uploaded the files and checked that the site is working fine on http. Next I went to Server Configuration > Manage SSL Certificate. Clicked the Lets Encrypt tab, the correct domains were listed there so I clicked on Request Certificate button. Then I got this error and only this in the log;

myorganicfoodfarms.com challenge did not pass: Invalid response from http://myorganicfoodfarms.com/.well-known/acme-challenge/uAFxieLvKF5nX_hS669GTnm_yVI8aqq2QKKgLR3x9Qo: “\n\n404 Not Found\n\n

Not Found

\n<p”

I checked in the file manager that Lets encrypt has not created any .well-known folder in public_html so ofcourse its getting a 404 error. What should I do to resolve or troubleshoot this?

Check the permissions and ownership of that site’s directories.

public_html is 750. All folders inside public_html are 755 and files are 644.

Ownership of all folders and files are “moff:moff” where moff is the user name associated with this domain. I’m logged in with root account. I hope this info helps.

Please help me troubleshoot this issue

I think I’ve fixed the error by removing the virtual host myip:443 from /etc/apache2/sites-available/domainname.conf file. The certificate was generated successfully and then I had to copy the code I removed earlier back to the file.

I never had to do this until now so there’ssome issue here for sure.