Unauthorized invalid response from <domain>/.well-known/acme-challenge/etc

I put “sup” into a.txt in the directory I put but I get an Nginx 404. Not sure if I had to reboot first.

Did you modify the config?
Did you also restart the web server?

I’m still seeing a redirection (that should no longer be there):

curl -Iki http://morocotagold.gq/.well-known/acme-challenge/test-file-1234
HTTP/1.1 301 Moved Permanently
Server: nginx/1.10.3 (Ubuntu)
Date: Mon, 14 Sep 2020 20:37:19 GMT
Content-Type: text/html
Content-Length: 194
Connection: keep-alive
Location: https://morocotagold.gq/.well-known/acme-challenge/test-file-1234

Should I post another screenshot of the beginning of the config file?

Please pay close attention to the "details"

You created a file with the .txt extension - that will not match the expected file type (for challenge files)
It may be handled differently then the file type requested "test-file-1234" (no extension type)

I don't need screenshot
I only need for you to follow the directions and answer the questions.
Like:

Yes, removed the .txt ext. and reloaded Nginx.

OK what is the name of the file you created?
[I don’t need the full path name - just the file name itself]

a. Could it be because I didn’t put its containing text around <html> tags?

Does the file exist?
Does it have any content?

Yes and yes. Putting more text to satisfy character requirements.

Then the modification has NOT taken.
Please show the modified HTTP server block section.
[you can change the path after we get this going]

Oh, I’m so sorry. PEBCAK. Didn’t put the “/” after the new folder’s name in the config. Just restarted Nginx.

I think there is a bigger problem still:

curl -Iki http://morocotagold.gq/.well-known/acme-challenge/a
HTTP/1.1 301 Moved Permanently
Server: nginx/1.10.3 (Ubuntu)
Date: Mon, 14 Sep 2020 20:49:56 GMT
Content-Type: text/html
Content-Length: 194
Connection: keep-alive
Location: https://morocotagold.gq/.well-known/acme-challenge/a

curl -Iki http://morocotagold.gq/.well-known/acme-challenge/a.
HTTP/1.1 301 Moved Permanently
Server: nginx/1.10.3 (Ubuntu)
Date: Mon, 14 Sep 2020 20:49:58 GMT
Content-Type: text/html
Content-Length: 194
Connection: keep-alive
Location: https://morocotagold.gq/.well-known/acme-challenge/a.

I should be seeing 200 or 404
NOT 301 moved

Let’s try it this way:

server {
  listen 80;
  listen [::]:80;
  server_name morocotagold.gq;
  location /.well-known/acme-challenge/ {
    access_log off;
    # send all challenge requests to a newly created/dedicated folder
    root /ACMEchallenges/;
    try_files $uri 405;
  }#location
  location / {
    return 301 https://$server_name$request_uri; #redirect HTTP to HTTPS
  }#location
}#server
1 Like

Please tell me you created that syslib folder - that it didn’t already exist

$ l /etc/syslib

returns a, so yes. And yes I created it. I made the config change and reloaded.

OK I need to confirm that your change has actual been applied by nginx (which I doubt); as I still see:
HTTP/1.1 301 Moved Permanently

So, please show the output of:
sudo nginx -T | grep -i 'virtual|server|root|return'