OK, I think nginx does things a bit differently than one expects.
Try making the challenge path within that root path: mkdir /var/www/certbot/.well-known mkdir /var/www/certbot/.well-known/acme-challenge echo another-test-file > /var/www/certbot/.well-known/acme-challenge/Test-File-4321
then we test with: http://alsharakagroup.com/.well-known/acme-challenge/Test-File-4321
And, yeah, the test file 1234 was placed in the root - not acme-challenge - so would not have been found. The @rg305 commands for the 4321 file are better.
But, I am now getting the 'connection refused' response from the server again for http.
I still think it is good idea to have an error_log while debugging
I apologize for the time, but I was trying to reduce the burden and solve the problem myself, but it was no use
nginx_1 | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
nginx_1 | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
nginx_1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
nginx_1 | 10-listen-on-ipv6-by-default.sh: Getting the checksum of /etc/nginx/conf.d/default.conf
nginx_1 | 10-listen-on-ipv6-by-default.sh: /etc/nginx/conf.d/default.conf differs from the packages version, exiting
nginx_1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
nginx_1 | /docker-entrypoint.sh: Configuration complete; ready for start up
@Elabbasy00 Yeah, that is not the nginx error_log I described. It has a format like:
2014/09/10 16:55:16 [crit] 10808#0: *2 stat() "/username/test/static/index.html" failed (13: Permission denied), client:, server: localhost, request: (omitted for brevity)
2014/09/10 16:55:16 [error] 10808#0: *2 rewrite or internal redirection cycle while internally redirecting to "/index.html
When debugging tricky problems, the more info we can gather the better. Just place the error_log line I described in the nginx server section for your port 80 server. I set the level to 'info' in that line to get the most data possible
It seems like you are really close. I am again successfully seeing your server on http and getting 301 as expected and 404 (as not expected if you added the -4321 test file per @rg305). We need more info to resolve.
I see you are having trouble pasting the error log. I saw your first paste which showed a failure opening the Test-File-4321. It is helpful to go slow - one step at a time. Did you create that file per @rg305 suggestion here:
Update: I see you did figure out the error log paste but I would still prefer to start with the test file (little steps ...)
If not, do that and also figure out how to paste the full text from the error_log or even upload the error file.
The port binding for 80 and 443 is a problem too. But given its timestamp and that we are getting later responses from nginx I do not see that as a current problem. I could be wrong but let us leave for later. You do not have a second nginx running do you? Or Apache? Or perhaps Docker is taking those ports? Anyway, on my Linux I use the below command to look at listeners - you may need a different command.
sudo netstat -tunlp | grep LISTEN
Let us know when you have the Test-File-4321 in place
Are you sure the nginx config you showed in your first post is being used?
I ask because it had server_tokens off;
Yet, I just got a 404 for the test index file but it had the Server: nginx/1.19.0 header in the response. The server tokens config being off should suppress that header.
Much of what we are seeing would make more sense if your nginx was running with a different config than what you showed. Try running
sudo nginx -T
and make sure it is what you expect. Maybe even upload it here too. Maybe someone else can see something - I am having a hard time following the things you keep trying.