Hi,
The certbot was unable to renew my certificate in the ghost subdomain I have this output when running :
sudo certbot certonly --webroot --webroot-path=/var/www/ghost -d blog.hatandslash.com -d www.blog.hatandslash.com
Failed authorization procedure. blog.hatandslash.com (http-01): urn:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://blog.hatandslash.com/.well-known/acme-challenge/N0DCgm6dmkv5Wv6KSoBUuFkf0zqOTD76pOR5INinHBY: "<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>", www.blog.hatandslash.com (http-01): urn:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://www.blog.hatandslash.com/.well-known/acme-challenge/GxhMHQv903Ct6UJhIuA7hGMUzeRySxUs4_o5LlYjUlg: "<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>"
IMPORTANT NOTES:
- The following errors were reported by the server:
Domain: blog.hatandslash.com
Type: unauthorized
Detail: Invalid response from
http://blog.hatandslash.com/.well-known/acme-challenge/N0DCgm6dmkv5Wv6KSoBUuFkf0zqOTD76pOR5INinHBY:
"<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>"
Domain: www.blog.hatandslash.com
Type: unauthorized
Detail: Invalid response from
http://www.blog.hatandslash.com/.well-known/acme-challenge/GxhMHQv903Ct6UJhIuA7hGMUzeRySxUs4_o5LlYjUlg:
"<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>"
To fix these errors, please make sure that your domain name was
entered correctly and the DNS A record(s) for that domain
contain(s) the right IP address.
I have checked the folder permisions and these are:
drwxr-xr-x 6 ghost ghost 4096 May 11 21:09 .
drwxr-xr-x 6 root root 4096 May 9 23:58 ..
-rwxr-xr-x 1 ghost ghost 4511 Jan 12 12:20 config.example.js
-rwxr-xr-x 1 ghost ghost 4784 Feb 5 18:14 config.js
-rwxr-xr-x 1 ghost ghost 4510 Jan 31 02:24 config.js.save
-rwxr-xr-x 1 ghost ghost 4776 Feb 5 20:15 config.js.save.1
drwxr-xr-x 6 ghost ghost 4096 Jan 12 12:26 content
drwxr-xr-x 5 ghost ghost 4096 Jan 12 12:26 core
-rwxr-xr-x 1 ghost ghost 31937 Jan 12 12:20 Gruntfile.js
-rwxr-xr-x 1 ghost ghost 725 Jan 12 12:20 index.js
-rwxr-xr-x 1 ghost ghost 1065 Jan 12 12:20 LICENSE
drwxr-xr-x 103 ghost ghost 4096 Jan 30 19:42 node_modules
-rwxr-xr-x 1 ghost ghost 211911 Jan 12 12:26 npm-shrinkwrap.json
-rwxr-xr-x 1 ghost ghost 3029 Jan 12 12:20 package.json
-rwxr-xr-x 1 ghost ghost 2942 Jan 12 12:20 PRIVACY.md
-rwxr-xr-x 1 ghost ghost 4710 Jan 12 12:20 README.md
drwxr-xr-x 2 root root 4096 May 11 22:33 .well-known
But there the acme-challenge folder is missing.
I have already tried to change the permissions to 755 or assign the group user to www-data:www-data and still nothing works.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hi!
I’m assuming that you have set up nginx to proxy requests to the Ghost app. In that case, Ghost does not serve static files from
/var/www/ghost
. You will need to override the proxy settings for/.well-known
urls and configure nginx to serve those files directly. Once you have done that, Let’s Encrypt will be able to verify your ownership of the domain and renew your certificate.Add the following lines to your nginx server block above the
location / {}
block that includes the proxying-related directives:Reload nginx and you should now be able to renew your certificate. Let me know how that goes!
P.S. I would suggest using a different directory to keep things clean and separate. For example,
/var/www
or any other directory.