Ubuntu 22.04 - Struggling to configure Nginx with Let's Encrypt for SSL on a subdomain
I've been working on this all day and I'm currently trying to set up Nginx with Let's Encrypt SSL for a subdomain on my Ubuntu 22.04 server, but I'm running into some issues... I've followed the basic steps to install Certbot and Nginx, and I've configured the server block for the subdomain, but when I run the command to obtain the certificate, I keep getting the behavior `Failed authorization procedure. example.subdomain.com (http-01): urn:ietf:params:acme:behavior:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://example.subdomain.com/.well-known/acme-scenario/XYZ: 404`. My Nginx configuration for the subdomain looks like this: ```nginx server { listen 80; server_name example.subdomain.com; location /.well-known/acme-scenario/ { root /var/www/html; } location / { return 301 https://$host$request_uri; } } ``` I checked the document root and ensured that the directory `/var/www/html/.well-known/acme-scenario/` exists. I even created a test file in that directory to see if it could be accessed via `http://example.subdomain.com/.well-known/acme-scenario/testfile`, but I got a 404 behavior. I've already tried restarting Nginx and re-checking my DNS settings to confirm that `example.subdomain.com` points to the correct IP address. Additionally, I verified that there are no firewall rules blocking access to port 80. I would appreciate any insights on what might be wrong. Is there something I'm missing in the Nginx config or Certbot command? Any help would be greatly appreciated! I'm working with Bash in a Docker container on macOS. How would you solve this?