<div dir="ltr"><div dir="ltr"><div>since i do this through haproxy, it will be a little different, but where ever port 80 is open to you can have a block that does the following</div><div>so in the http block of haproxy i send it to a backend when it meets these requirements.</div><div><br></div><div>acl letsencrypt-request path_beg -i /.well-known/acme-challenge/</div><div>redirect scheme https code 301 unless letsencrypt-request<br> use_backend letsencrypt-backend if letsencrypt-request</div><div><br></div><div>Which sends the request to a local nginx instance (on the live haproxy server) that can validate the cert b/c server_name = _; I generate these regularly, so my setup is a little different, but <br></div><div><pre style="background-color:rgb(43,43,43);color:rgb(169,183,198);font-family:"Fira Code Medium";font-size:9pt">server {<br> listen 8888 proxy_protocol;<br> server_name _;<br> charset utf-8;<br> set_real_ip_from {{ servers.lb.master.ip }};<br> set_real_ip_from {{ servers.lb.slave.ip }};<br> real_ip_header proxy_protocol;<br> root /var/www/html;<br> location ~ /.well-known {<br> allow all;<br> }<br> deny all;<br>}<br></pre></div></div><div>in a regular, single server nginx setup, i use the following block:</div><div><br></div><div>server {<br> listen 80 default_server;<br> listen [::]:80 default_server;<br> server_name <a href="http://example.com">example.com</a> <a href="http://www.example.com">www.example.com</a>;<br> location ~ /.well-known {<br> allow all;<br> }<br> return 301 <a href="https://www.example.com">https://www.example.com</a>$request_uri;<br>}</div><div><br></div><div>So it will only redirect if its not a lets encrypt request. HAProxy may mean nothing to you, but it shows an alternate configuration. And of course Francis is correct, you need 80 open.</div><div><br></div><div>HTH<br></div><div>Jeff<br></div><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Feb 2, 2020 at 5:49 AM Francis Daly <<a href="mailto:francis@daoine.org">francis@daoine.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Fri, Jan 31, 2020 at 10:33:31PM +0100, bagagerek wrote:<br>
<br>
Hi there,<br>
<br>
> I followed the manual but I can't seem tot get it right. I've forwarded port<br>
> 8081 on my router.<br>
<br>
If you want letsencrypt to use the "http" challenge, you must let incoming<br>
traffic in on port 80 (and, presumably, send it to nginx).<br>
<br>
f<br>
-- <br>
Francis Daly <a href="mailto:francis@daoine.org" target="_blank">francis@daoine.org</a><br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org" target="_blank">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</blockquote></div></div></div>