Attempting to renew cert... (Dry run)

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

listen localhost:110;

listen localhost:143;

listen 443 ssl; # managed by Certbot

listen 80;

in the section 80 part I provided change to this (temporarily):

[add two lines and two #]

Done and restarted Ngninx

Closer.
I don’t see the redirection anymore.
But I neither of:
"you found me"
"you didn't find me"

Let me try from another browser/system
Maybe there is some chaching going on - could be this side or your side.

OK definitely something was being cached.
From other system, I get:
image

But that should have been:
"you found me"

So we have a typo/syntax/logic problem there.

Try:

server {
   listen 80;
   server_name test.ericmauldin.info;
   location /.well-known/acme-challenge/ {
      root /root/recipe-app-backend/;
      #try_files $uri 404;
      return 200 "you found me";
   }#location
   location / {
      #return 301 https://$host$request_uri;
      return 200 "you didn't find me";
   }#location
}#server

that should be found

Copied, pasted and restarted nginx.

Hallelujah!!!
image

Now remove the two “finds” and two #

server {
  listen 80;
  server_name test.ericmauldin.info;
  location /.well-known/acme-challenge/ {
     root /root/recipe-app-backend/;
     try_files $uri 404;
  }#location
  location / {
     return 301 https://$host$request_uri;
  }#location
}#server

Aaaaaand done and restarted

OK the redirection looks good:

curl -Iki http://test.ericmauldin.info/
HTTP/1.1 301 Moved Permanently
Server: nginx/1.17.10 (Ubuntu)
Date: Thu, 07 May 2020 20:37:35 GMT
Content-Type: text/html
Content-Length: 179
Connection: keep-alive
Location: https://test.ericmauldin.info/

But the “test-file” is still not accessible:
[make sure you didn’t delete it and it is still there - check file rights too]

curl -Iki http://test.ericmauldin.info/.well-known/acme-challenge/test-file
HTTP/1.1 404 Not Found
Server: nginx/1.17.10 (Ubuntu)
Date: Thu, 07 May 2020 20:37:51 GMT
Content-Type: text/html
Content-Length: 163
Connection: keep-alive

to be clear, the test-file.txt should be in the root level of my app, correct?

/recipe-app-backend/test-file.txt is where it lives at the moment

To be clear:
The file name is: test-file
The location is: /root/recipe-app-backend/
The URL is: http://test.ericmauldin.info/.well-known/acme-challenge/test-file

ok i have renamed to test-file (dropping the .txt)

Does not match:

Two differences…

paths:
/recipe-app-backend/
not equal
/root/recipe-app-backend/

filename:
test-file.txt
not equal
test-file

got it. We are now working with /root/recipe-app-backend/test-file

You are going to have to check you server logs (error logs).
It fails to find that file.
[tried multiple browsers and curl]

Forgot that we never added logging…
Try:

server {
  listen 80;
  server_name test.ericmauldin.info;
  location /.well-known/acme-challenge/ {
     root /root/recipe-app-backend/;
     access_log /some/path/you/like/access-log-file-name.txt
     error_log /some/path/you/like/error-log-file-name.txt
     try_files $uri 404;
  }#location
  location / {
     return 301 https://$host$request_uri;
  }#location
}#server

Thank you this is done and restarted nginx

I’m getting a 404. Just for my sanity, here is a list of the files…

root@atl:~/recipe-app-backend# ls -a
. .env models package-lock.json schema.sql test-file
… .git node_modules public seed.sql
controllers index.js package.json routes sessions