Good Day, I have nginx running in a docker container and configured to use let’s encrypt for certificates services. The location redirect to /var/www/certbot from /.well-known/acme-challenge does not seem to work.
Shown below is the contents of the target location and the contents. ****** df -h & directory contents of nginx instance. root@b15f5f234fbb:/var/log/nginx# df -h Filesystem Size Used Avail Use% Mounted on overlay 28G 9.1G 17G 35% / tmpfs 64M 0 64M 0% /dev tmpfs 461M 0 461M 0% /sys/fs/cgroup shm 64M 0 64M 0% /dev/shm coolwave.lese-fowler.us:/volume1/homes/pi/nginx/certbot/conf 1.8T 1.2T 685G 63% /etc/letsencrypt /dev/root 28G 9.1G 17G 35% /etc/hosts coolwave.lese-fowler.us:/volume1/homes/pi/nginx/conf 1.8T 1.2T 685G 63% /etc/nginx/conf coolwave.lese-fowler.us:/volume1/homes/pi/nginx/certbot/www 1.8T 1.2T 685G 63% /var/www/certbot coolwave.lese-fowler.us:/volume1/homes/pi/www 1.8T 1.2T 685G 63% /var/www/html coolwave.lese-fowler.us:/volume1/homes/pi/nginx/logs 1.8T 1.2T 685G 63% /var/log/nginx coolwave.lese-fowler.us:/volume1/homes/pi/nginx/logs 1.8T 1.2T 685G 63% /usr/share/nginx/logs tmpfs 461M 0 461M 0% /proc/asound tmpfs 461M 0 461M 0% /sys/firmware root@b15f5f234fbb:/var/log/nginx# cd /var/www/certbot root@b15f5f234fbb:/var/www/certbot# ls -l total 12 -rw-r--r-- 1 root root 1727 Mar 18 03:22 index.html -rw-r--r-- 1 root root 1531 Mar 18 03:23 test.html -rw-r--r-- 1 root root 1533 Mar 9 02:59 test2.html root@b15f5f234fbb:/var/www/certbot# ******************************** Access & Error Logs. root@b15f5f234fbb:/var/log/nginx# 10.0.0.2 - - [19/Mar/2021:21:28:27 +0000] "GET /.well-known/acme-challenge/index.html HTTP/1.1" 404 555 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36" "-" 2021/03/19 21:28:27 [warn] 15#15: no resolver defined to resolve r3.o.lencr.org while requesting certificate status, responder: r3.o.lencr.org, certificate: "/etc/letsencrypt/live/cyva.lese-fowler.us/fullchain.pem" 2021/03/19 21:28:27 [error] 15#15: *1 open() "/var/www/certbot/.well-known/acme-challenge/index.html" failed (2: No such file or directory), client: 10.0.0.2, server: cyva.lese-fowler.us, request: "GET /.well-known/acme-challenge/index.html HTTP/1.1", host: "cyva.lese-fowler.us" 10.0.0.2 - - [19/Mar/2021:21:28:32 +0000] "GET /.well-known/acme-challenge/ HTTP/1.1" 404 555 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36" "-" 2021/03/19 21:28:32 [error] 15#15: *1 "/var/www/certbot/.well-known/acme-challenge/index.html" is not found (2: No such file or directory), client: 10.0.0.2, server: cyva.lese-fowler.us, request: "GET /.well-known/acme-challenge/ HTTP/1.1", host: "cyva.lese-fowler.us" 10.0.0.2 - - [19/Mar/2021:21:28:40 +0000] "GET /.well-known/acme-challenge/test.html HTTP/1.1" 404 555 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36" "-" 2021/03/19 21:28:40 [error] 15#15: *1 open() "/var/www/certbot/.well-known/acme-challenge/test.html" failed (2: No such file or directory), client: 10.0.0.2, server: cyva.lese-fowler.us, request: "GET /.well-known/acme-challenge/test.html HTTP/1.1", host: "cyva.lese-fowler.us" 2021/03/19 21:29:27 [info] 15#15: *2 client timed out (110: Connection timed out) while waiting for request, client: 10.0.0.2, server: 0.0.0.0:443 2021/03/19 21:31:56 [error] 15#15: *4 open() "/var/www/certbot/.well-known/acme-challenge/test.html" failed (2: No such file or directory), client: 10.0.0.2, server: cyva.lese-fowler.us, request: "GET /.well-known/acme-challenge/test.html HTTP/1.1", host: "cyva.lese-fowler.us" 10.0.0.2 - - [19/Mar/2021:21:31:56 +0000] "GET /.well-known/acme-challenge/test.html HTTP/1.1" 404 555 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36" "-" 10.0.0.2 - - [19/Mar/2021:21:31:56 +0000] "GET /favicon.ico HTTP/1.1" 200 318 "https://cyva.lese-fowler.us/.well-known/acme-challenge/test.html" "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36" "-" 2021/03/19 21:32:56 [info] 15#15: *5 client timed out (110: Connection timed out) while waiting for request, client: 10.0.0.2, server: 0.0.0.0:443 ********************************* Nginx.conf # Designed to host port 80 & 443 for web viewing # port 8080 is configured to pass traffic to pi3.lese-fowler.us # port 1883 and 8883 are configured to pass tcp streams to # pi3.lese-fowler.us as well. # load_module modules/nginx-plus-module-headers-more # load_module modules/nginx-plus-module-set-misc # load_module modules/ngx_stream_proxy_module load_module /etc/nginx/modules/ngx_stream_module.so; # # configuration file /etc/nginx/nginx.conf: #user nobody; worker_processes 1; # error_log /var/log/nginx/error.log debug; error_log /var/log/nginx/error.log debug; #error_log /var/log/nginx/error.log notice; #error_log /var/log/nginx/error.log info; #pid /var/log/nginx/nginx.pid; events { worker_connections 1024; } # http { include mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; # # sendfile on; # tcp_nopush on; # keepalive_timeout 65; # set_real_ip_from 10.0.0.0/16; set_real_ip_from 172.16.0.0/24; set_real_ip_from 192.168.0.0/24; real_ip_header X-Real-IP; # server { # Add headers to serve security related headers # Before enabling Strict-Transport-Security headers please read into this # topic first. #add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;" always; # # WARNING: Only add the preload option once you read about # the consequences in https://hstspreload.org/. This option # will add the domain to a hardcoded list that is shipped # in all major browsers and getting removed from this list # could take several months. add_header Referrer-Policy "no-referrer" always; add_header X-Content-Type-Options "nosniff" always; add_header X-Download-Options "noopen" always; add_header X-Frame-Options "SAMEORIGIN" always; add_header X-Permitted-Cross-Domain-Policies "none" always; add_header X-Robots-Tag "none" always; add_header X-XSS-Protection "1; mode=block" always; # add_header cache-control: public, max-age=120; # Remove X-Powered-By, which is an information leak fastcgi_hide_header X-Powered-By; listen 80; server_name cyva.lese-fowler.us 172.16.10.30; access_log /var/log/nginx/cyva.access.log main; root /var/www/html; # location ^~ /.well-known/acme-challenge { # location ^~ /.well-known/ { # allow all; # } # alias vs root location /.well-known/acme-challenge/ { allow all; root /var/www/certbot; try_files $uri =405; } location / { allow all; } location = /robots.txt { allow all; log_not_found on; access_log on; } # serve static files # location ~ ^/(images|javascript|js|css|flash|media|static)/ { #location ~* / { # alias /var/www/html; # expires 30d; #} # redirect http to https www return 301 https://cyva.lese-fowler.us$request_uri; # Enable gzip but do not remove ETag headers gzip on; gzip_vary on; gzip_comp_level 4; gzip_min_length 256; gzip_proxied expired no-cache no-store private no_last_modified no_etag auth; gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy; # # Uncomment if your server is build with the ngx_pagespeed module # This module is currently not supported. #pagespeed off; # # location / { # rewrite ^ /index.html; #} location ~ ^\/(?:build|tests|config|lib|3rdparty|templates|data)\/ { deny all; } location ~ ^\/(?:\.|autotest|occ|issue|indie|db_|console) { deny all; } # } server { # http2 listen [::]:443 ssl; listen 443 ssl; server_name cyva.lese-fowler.us 172.16.10.30; root /var/www/html; # SSL code ssl_certificate /etc/letsencrypt/live/cyva.lese-fowler.us/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/cyva.lese-fowler.us/privkey.pem; ssl_session_timeout 1d; ssl_session_cache shared:SharedNixCraftSSL:10m; ssl_session_tickets off; # TLS 1.2 & 1.3 only ssl_protocols TLSv1.2 TLSv1.3; ssl_prefer_server_ciphers on; ssl_ciphers "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS"; # HSTS (ngx_http_headers_module is required) (63072000 seconds) add_header Strict-Transport-Security "max-age=63072000" always; # OCSP stapling ssl_stapling on; ssl_stapling_verify on; # location ~ /.well-known { # allow all; # } # verify chain of trust of OCSP response using Root CA and Intermediate certs # ssl_trusted_certificate /etc/nginx/ssl/fullchain.pem; # location ^~ /.well-known/acme-challenge/ { # location ^~ /.well-known/ { location /.well-known/acme-challenge/ { allow all; root /var/www/certbot; } location / { allow all; index index.html; } } # simple reverse-proxy server { listen 8080; server_name cyva.lese-fowler.us 172.16.10.30; access_log /var/log/nginx/reverse.access.log main; # serve static files location / { proxy_pass https://pi3.lese-fowler.us:80; } } } # End of html block # *********************** # The following code is not permitted until we find the correct nginx code # stream { log_format st-main '$remote_addr - [$time_local] $status $bytes_sent '; server { listen 8084; access_log /var/log/nginx/mqtt-non.log st-main; #TCP traffic will be forwarded to the "stream_backend" upstream group proxy_pass cyva.lese-fowler.us:1883; } # server { listen 8085; access_log /var/log/nginx/mqtt.log st-main; #TCP traffic will be forwarded to the specified server proxy_pass cyva.lese-fowler.us:8883; } } # _______________________________________________ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx