Hello,
first I have to say I am new to server administration and I’m learning at the moment.
When I run certbot certonly --webroot -d example.com -d www.example.com
I get:
Waiting for verification...
Cleaning up challenges
Failed authorization procedure. www.domain.tld (http-01): urn:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://www.domain.tld/.well-known/acme-challenge/***key***: "<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
"
IMPORTANT NOTES:
- If you lose your account credentials, you can recover through
e-mails sent to admin@domain.tld.
- The following errors were reported by the server:
Domain: www.domain.tld
Type: unauthorized
Detail: Invalid response from
http://www.domain.tld/.well-known/acme-challenge/***key***:
"<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
"
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.
- Your account credentials have been saved in your Certbot
configuration directory at /etc/letsencrypt. You should make a
secure backup of this folder now. This configuration directory will
also contain certificates and private keys obtained by Certbot so
making regular backups of this folder is ideal.
This is my /etc/nginx/sites-available/default
:
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
server_name example.com www.example.com;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
}
location ~ /\.ht {
deny all;
}
location ~ /.well-known {
allow all;
}
}
When I put a test.txt
into /var/www/html/.well-known/acme-challenge/
I can successfully access it in my browser.