Invalid response ".well-known"

That could have been clearer/cleaner/less problematic for any future changes as:

server {
    listen 80 default_server;
    listen [::]:80 default_server;
    root /var/www/html;
    server_name  example.com www.example.com;

    # Redirect non-https traffic to https
    if ($scheme != "https") {
        return 301 https://$host$request_uri;
    } # managed by Certbot
}
server {
    listen 443 ssl; # managed by Certbot
    root /var/www/html;
    server_name  example.com www.example.com;

    # RSA certificate
    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot

    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
}

I guess that example is what it is because Certbot is making the changes. Therfore that is what the nginx conf will look like after the automatet changes are made.

Anyway. I have a fully functional port 80 way into my server. I can reach it. But I get 404 error when trying to create the cert.

Maybe the Certbot is trying to create the file in wrong path?

The logs can show what it did.

We can also try using --webroot method:
Where you replace --nginx from the command with:
--webroot -w /var/www/html
[NOTE: webroot MUST USE THE SAME root FOLDER AS IN YOUR CONFIG FILE]
[so change that path to match your actual path]

It says
Saving debug log to /var/log/letsencrypt/letsencrypt.log

But there is no log file there. I even tried running certbot command with sudo administartor user.
Strange.

I don’t have the nginx config in ‘var’. it’s in ‘etc’.

Look for the line with “root” in your config that listens on port 8004
That is the path you need to use with --webroot

I posted my full config above. I don’t have a ‘root’. Except from the line I added for .well-known

Edit// I used the root I added with .well-known and it looks like it passed. I’ll try to add all new lines manually now. Fingers crossed

If you followed the guide, then you have:

Does that path exist?
If so, then it can be used in the command:
sudo certbot --nginx -d example.com -d www.example.com
as
sudo certbot certonly --webroot -w /var/www/html -d example.com -d www.example.com

[change the domains to match your need]

Did it say “Congratulations…” ?
Check your certs with:
sudo certbot certificates

Yes I finally got Congratulations. Now I’m looking into why I still can’t connect to my webserver via https. But I want to struggle some before asking about this.

Why struggle?
Just ask…

I cannot give better advice than to ask your hosting provider to supply a PLESK management console.
With that it is as simple as ABC. If your hosting provider cannot help you, change your hosting provider!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.