Missing acme-challenge folder


#1

I tried create a new certificates for my web app (use Laravel) with Let’s encrypt but always getting error.
.well-known folder was successful created automatically when i run the command, but not with acme-challenge. I tried it four days ago.

My domain is:
http://jajancustom.com/

I ran this command:

sudo letsencrypt certonly -a webroot --webroot-path=/var/www/html/jajancustom.com -d jajancustom.com -d www.jajancustom.com

It produced this output:

Failed authorization procedure. jajancustom.com (http-01): urn:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://jajancustom.com/.well-known/acme-challenge/0BXIIlE7Ay552RBZ_fvu5perhomsLISrfk5fAB6mPWU: “\r\n404 Not Found\r\n<body bgcolor=“white”>\r\n

404 Not Found

\r\n
”, www.jajancustom.com (http-01): urn:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://www.jajancustom.com/.well-known/acme-challenge/jijc5kYMH91E4vxbK3ss5gLDcfGC-axqDCNMWdCZdjI: “\r\n404 Not Found\r\n<body bgcolor=“white”>\r\n

404 Not Found

\r\n

IMPORTANT NOTES:

  • The following errors were reported by the server:

    Domain: jajancustom.com
    Type: unauthorized
    Detail: Invalid response from http://jajancustom.com/.well-known
    /acme-challenge/0BXIIlE7Ay552RBZ_fvu5perhomsLISrfk5fAB6mPWU:
    “\r\n404 Not Found\r\n<body
    bgcolor=“white”>\r\n

    404 Not
    Found

    \r\n

    Domain: www.jajancustom.com
    Type: unauthorized
    Detail: Invalid response from http://www.jajancustom.com/.well-
    known/acme-challenge/jijc5kYMH91E4vxbK3ss5gLDcfGC-axqDCNMWdCZdjI:
    “\r\n404 Not Found\r\n<body
    bgcolor=“white”>\r\n

    404 Not
    Found

    \r\n

    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.

My web server is (include version):
nginx version: nginx/1.10.3 (Ubuntu)

The operating system my web server runs on is (include version):
Ubuntu 16.04.5 LTS (GNU/Linux 4.4.0-138-generic x86_64)

My hosting provider, if applicable, is:
DigitalOcean (droplet)

I can login to a root shell on my machine (yes or no, or I don’t know):
yes

I’m using a control panel to manage my site (no, or provide the name and version of the control panel):
no


#2

Certbot (formerly known as letsencrypt) automatically deletes the challenge file and acme-challenge directory (if it’s now empty). It was probably successfully created.

What does Nginx’s error.log say?

What’s the Nginx configuration for that virtual host?


#3

Hi @arifinofficial

additional:

create the two directories in your webroot-path:

/var/www/html/jajancustom.com/.well-known/acme-challenge

then create a small file (file name 1234 without extension) and save it. Then test, if you can load this file via

http://jajancustom.com/.well-known/acme-challenge/1234

Then execute letsencrypt again with the

--debug-challenges

Then letsencrypt waits and you can check, if the file is created in the correct directory.


#4

Thank for your response.

This is my log error Nginx:

2018/11/17 14:34:11 [error] 28753#28753: *354 open() "/var/www/html/jajancustom.com/public/.well-known/acme-challenge/56QmN1MKRtPUZtBkVwkhyfOIIxMGfSkxVV9lz-Nzg-c" failed (2: No such file or directory), client: 64.78.149.164, server: jajancustom.com, request: "GET /.well-known/acme-challenge/56QmN1MKRtPUZtBkVwkhyfOIIxMGfSkxVV9lz-Nzg-c HTTP/1.1", host: "jajancustom.com"
2018/11/17 14:34:11 [error] 28753#28753: *355 open() "/var/www/html/jajancustom.com/public/.well-known/acme-challenge/ywXBlELuUwASF_n4Dydd7qM6VfxpICh4eHIsZNRrtzk" failed (2: No such file or directory), client: 64.78.149.164, server: jajancustom.com, request: "GET /.well-known/acme-challenge/ywXBlELuUwASF_n4Dydd7qM6VfxpICh4eHIsZNRrtzk HTTP/1.1", host: "www.jajancustom.com"
2018/11/17 14:40:51 [notice] 10704#10704: signal process started
2018/11/17 14:41:11 [error] 10707#10707: *359 open() "/var/www/html/jajancustom.com/public/.well-known/acme-challenge/test" failed (2: No such file or directory), client: 180.249.117.250, server: jajancustom.com, request: "GET /.well-known/acme-challenge/test HTTP/1.1", host: "jajancustom.com"
2018/11/17 14:41:31 [error] 10707#10707: *359 open() "/var/www/html/jajancustom.com/public/.well-known/acme-challenge/test" failed (2: No such file or directory), client: 180.249.117.250, server: jajancustom.com, request: "GET /.well-known/acme-challenge/test HTTP/1.1", host: "jajancustom.com"
2018/11/17 14:44:06 [error] 10707#10707: *364 open() "/var/www/html/jajancustom.com/public/.well-known/acme-challenge/test" failed (2: No such file or directory), client: 180.249.117.250, server: jajancustom.com, request: "GET /.well-known/acme-challenge/test HTTP/1.1", host: "jajancustom.com"
2018/11/17 14:44:08 [error] 10707#10707: *364 open() "/var/www/html/jajancustom.com/public/.well-known/acme-challenge/test" failed (2: No such file or directory), client: 180.249.117.250, server: jajancustom.com, request: "GET /.well-known/acme-challenge/test HTTP/1.1", host: "jajancustom.com"
2018/11/17 14:46:50 [error] 10707#10707: *366 open() "/var/www/html/jajancustom.com/public/.well-known/acme-challenge/test" failed (2: No such file or directory), client: 180.249.117.250, server: jajancustom.com, request: "GET /.well-known/acme-challenge/test HTTP/1.1", host: "jajancustom.com"
2018/11/17 15:43:02 [error] 10707#10707: *381 open() "/var/www/html/jajancustom.com/public/.well-known/acme-challenge/vyc4jESEj3znRcl5vUxiwTQjNh_ikn3G2fO-zRXzMkk" failed (2: No such file or directory), client: 64.78.149.164, server: jajancustom.com, request: "GET /.well-known/acme-challenge/vyc4jESEj3znRcl5vUxiwTQjNh_ikn3G2fO-zRXzMkk HTTP/1.1", host: "jajancustom.com"
2018/11/17 15:43:02 [error] 10707#10707: *382 open() "/var/www/html/jajancustom.com/public/.well-known/acme-challenge/XjPjOToptfbxs-zp1l5d55CsGEVKTSBbUQmlfAVDUqo" failed (2: No such file or directory), client: 64.78.149.164, server: jajancustom.com, request: "GET /.well-known/acme-challenge/XjPjOToptfbxs-zp1l5d55CsGEVKTSBbUQmlfAVDUqo HTTP/1.1", host: "www.jajancustom.com"
2018/11/17 15:49:30 [notice] 11262#11262: signal process started

This is my Nginx configuration server:

server {
	listen 80 default_server;
	listen [::]:80 default_server;

	root /var/www/html/jajancustom.com/public;

	# Add index.php to the list if you are using PHP
	index index.php index.html index.htm index.nginx-debian.html;

	server_name jajancustom.com www.jajancustom.com;

	location / {
		# First attempt to serve request as file, then
		# as directory, then fall back to displaying a 404.
		try_files $uri $uri/ =404;
	}

        location ~ /.well-known {
                allow all;
        }

	location ~ \.php$ {
                include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/run/php/php7.2-fpm.sock;
        }

        location ~ /\.ht {
                deny all;
        }
}


# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
#	listen 80;
#	listen [::]:80;
#
#	server_name example.com;
#
#	root /var/www/example.com;
#	index index.html;
#
#	location / {
#		try_files $uri $uri/ =404;
#	}
#}

#5

Looks like your webroot is this. Add /public/


#6

Yes, the webroot is /public/

I read this tutorial to setup laravel with TSL.

Thanks for your advice.