I’m trying to set certificates for my website but I’m struggling a little bit. I have two servers. My website run on dockers on server 2 (nginx, php, …) and server 1 run a nginx on port 7777. For the website, my nginx configuration is like that (port 80):
The certbot is on my server 2 and when I try to generate the certificate I got a 404 not found ( http:///.well-known/acme-challenge/c1mXZoarf…). It seems it’s not a problem of permission. I added an index.html on the /var/www/letsencrypt folder and curl <server 1 ip>:7777 return the file.
Yeah you right. So I moved the nginx to server 2 with the same configuration but I still have the same issue. Certbot should be able to generate file on /var/www/letsencrypt. I shared the volume like that (on the docker compose of certbot):
and then place a test.txt file as: /var/www/letsencrypt/test.txt
See if it can be hit form the Internet via: http://your.domain/.well-known/acme-challenge/test.txt
I tried and It seems like it can’t find the file: nginx_1 | 2018/11/16 13:24:37 [error] 7#7: *51 open() "/var/www/letsencrypt/.well-known/acme-challenge/test.txt" failed (2: No such file or directory), client: ...., server: <domain>, request: "GET /.well-known/acme-challenge/test.txt HTTP/1.1", host: "<domain>". It’s homehow searching on the wrong path.
Okay. By using alias and changing the nginx conf to
location /.well-known/acme-challenge/ {
allow all;
alias /var/www/letsencrypt/;
}
I can get the test file: curl http://<url>/.well-known/acme-challenge/test.txt. Unfortunately I still have a 404
I also don’t think it’s a permission issue because certbot seems to be able to create files. I tried like that $ docker-compose run certbot --help; touch /var/www/letsencrypt/aaa.txt (var/www/letsencrypt is shared)
Is it possible that’s is an issue related to ipv6? I have a curl: (6) Could not resolve host: <....> when I tried this command curl -ikL6 http://<url>/.well-known/acme-challenge/test.txt (working fine with -ikL4)
Does anyone have an idea? I’m pretty much lost at this point