Nginx Reverse Proxy Set Up Guide – Docker

Okay… literally banging my head on the keyboard… Apparently my port forwarding was incorrect… I have checked that one numerous times, but somehow completely missed the error :confounded:

So you got it to work?

Yes, once I changed the port forwarding it “just worked” :smile:

Doh. Thanks for this, just made me realise that this is probably my issue too since my router is set to forward port 443 to 8123.
I’ve been trying to setup up nginx for the past couple of weeks with the added complexity of having a wordpress site that I’m also trying to move to docker.
Guess I have to forward 443 (ext) to 443 (int, nginx’s ip address) for it to work.
Will have a go at it later then

That will definitely solve the problem! I had the exact same thing.

@juan11perez if you’re still able to update that first post, it would be a good idea to add that info for “knobs” (noob doesn’t apply here anymore I’m afraid to report) like me.
I followed the HA guide on how to setup HTTPS and I then completely forgot that I had my router set to port forward 443 to 8123…

it DID solve the problem. Soo simple :man_facepalming:

I know the feeling :thinking:. Good to know that my post helped you!

1 Like

Had a few difficulties over the past weeks migrating from rpi3 to ubuntu w/ docker.

Ended up using the ‘duckdns’ validation instead of ‘http’. Below is my letsencrypt portion of my compose file. Only port 443 is required to be open, which is a plus for me.

  letsencrypt:
    image: linuxserver/letsencrypt
    container_name: letsencrypt
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=<redacted>
      - URL=<redacted>.duckdns.org
      - VALIDATION=duckdns
      - DUCKDNSTOKEN=<redacted>
      - [email protected]
      - SUBDOMAINS=wildcard
    volumes:
      - /home/user/docker/letsencrypt/config:/config
      - /etc/localtime:/etc/localtime:ro
    ports:
      - 443:443
    restart: unless-stopped

i tried with above mentioned config,
with port as 6443 but no ssl certs are created under keys/letsencrypt.
Do i need to do something before this

If you look at the site default config, it is listening on port 443 on multiple lines. Does setting the port as 443 work? What do the container logs say?

Hey Bro. i’ am absolutely thank you so much for your thread. i spend two day in hell , try to configure home assistant , let’s encrypt to run on unraid. it’s make me so headache. thanks for you, i finally did it. thanks u so much. u are my hero.

you’re very welcome. glad it still works. happy to help

Thank you! I have been putting off trying this for a few months. Reading it over and over again to get an better understanding of what it is doing. I finally made the plunge and tried it yesterday and today. I got it up and going with only few hiccups! Again thanks, my network is now way more secure.

you’re welcome. I know the feeling :grinning:

Yes, it’s a working config but you ain’t using reverse proxy with your setup, it’s to independent islands who helps you get SSL cert working together

I struggle with the same as NGINX also do, have to disable proxy config in NGINX, I want to be able to use reversed proxy as it supposed, not disable the function

Same problem here, to let traffic from Sonos, Casts etc working inside reversed proxy

I am using reverse proxy, that;s what Traefik does. As a bonus Traefik also get’s the certificates form Let’s Encrypt. There is no portfowarding, other then to Traefik, in my router.

Try this tutorial, it will help you understand things: https://www.smarthomebeginner.com/traefik-reverse-proxy-tutorial-for-docker/

Piotr:

Hey, how did you get fail2ban working with the homeassistant auth? I want fail2ban to check on failed logins to homeassistant… Thanks in advance!

Here’s an example: https://github.com/bachya/smart-home/tree/master/nginx

I use Supervisor to launch fail2ban after NGINX starts running. I then use these settings for jails.

1 Like