I am trying to use certbot and letencrypt on my Ubuntu 16.0.4 server, so I can install a mail server.
I run certbot as follows:
sudo / opt / letencrypt / certbot-aut certonly --agree-tos --webroot -w / path / to / www / example -d example.com -d www.example.com
I get the following result from certbot (snippet below):
Domain: www.example.com
Type: unauthorized
Detail: Invalid response from
http://www.example.com/.well-known/acme-challenge/QEZwFgUGOJqqXHcLmTmkr5z83dbH3QlrIUk1S3JI_cg:
"<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.
This is what my directory structure looks like:
root@yourbox:/path/to/www/example$ ls -la
total 12
drwxr-xr-x 3 example root 4096 Nov 1 10:17 .
drwxr-xr-x 5 root webapps 4096 Nov 1 10:13 ..
drwxr-xr-x 2 root root 4096 Nov 1 10:36 .well-known
root@yourbox:/path/to/www/example$
root@yourbox:/path/to/www/example$ cd .well-known/
root@yourbox:/path/to/www/example/.well-known$ ls -la
total 8
drwxr-xr-x 2 root root 4096 Nov 1 10:36 .
drwxr-xr-x 3 example root 4096 Nov 1 10:17 ..
root@yourbox:/path/to/www/example/.well-known$
From above, I see that the task file does not exist (presumably?), Because it looks like certbot cannot write to the folder.
However, I first needed to verify that nginx was configured correctly and that it serves files from folders starting from the period.
This is the configuration file for nginx for the website (/ etc / nginx / sites-available / example):
server {
location ~ /\.well-known\/acme-challenge {
allow all;
}
}
(sudo touch/path/to/www/example/fake) :
root@yourbox:/path/to/www/example/.well-known/acme-challenge$ ls -l
total 0
-rw-r--r-- 1 example webapps 0 Nov 1 10:45 fake
http://www.example.com/.well-known/acme-challenge/fake - 404.
, :
- Nginx
.well-known/acme-challenge /path/to/www/example , certbot .well-known/acme-challenge.
?