Let's encrypt not working with Nginx on ubuntu 16.04

Hello Everyone,
I have a MEAN stack web site that runs on node.js server.

I followed the guild to obtain a ssl file using this command.
sudo certbot --nginx -d xxx.xxx.com
But I got this error.

======================
Type: unauthorized
Detail: Invalid response from
To fix these errors, please make sure that your domain name was
entered correctly and the DNS A/AAAA record(s) for that domain contain(s) the right IP address.

How can I fix this error? Thx.

Do you even run a nginx webserver?

sure.

Nginx webserver works well.

That might have been something to put in your post. You’re running it as a reverse proxy then, right?

Also, you’re already setting the HSTS header when your HTTPS isn’t working at all:

Strict-Transport-Security: max-age=31536000; includeSubDomains; preload

Probably not very wise until you’re absolutely certain your HTTPS is working flawlessly.


This is configurations for ngnix.

It has worked without ssl so far.

You should make sure requests for the path /.well-known/acme-challenge/ aren’t processed through your reverse proxy.

That’s because the HSTS header is only processed when it is received through HTTPS. But if you have a flaky HTTPS setup, some users might receive the HSTS header through HTTPS, enabeling it, after which perhaps your HTTPS setup, because not very stable for some reason, is disabled. Result: users with an enabled HSTS can’t reach your site any longer.

Tested it how? We can only work with the information you’re giving us. In this case, more is better…

I already tested it. But it returned the entire content of index file.

I could find some blogs and followed it.
Could you let me know how to test it again here?

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