Best practice for nginx reverse proxy to docker images across multiple hosts?

Yo,

Recently started moving services to docker containers to learn a new technology and provide better reliability. I have two raspberry pi’s, one which runs HASS related services (HASS, Node Red, InfuxDB, Grafana) and another one for non-HASS things (Plex, FTP, Samba shares, Pi-hole).

Ideally I want to be able to access all of them through https://my.domain.com.

Having never used nginx (although my full time job is a .net web dev), let alone set up a reverse proxy before wit hit, firstly is it feasible to run nginx on one pi but serve content from two, and secondly does anyone have any useful tutorials to point me at? I’m about to start working my way through a couple (https://cloud.google.com/community/tutorials/nginx-reverse-proxy-docker and http://jasonwilder.com/blog/2014/03/25/automated-nginx-reverse-proxy-for-docker/) but I’d rather work from recommendations from you guys

Cheers

I used Caddy as my reverse proxy.

Simply port forward 80 and 443 from your router to Caddy and set up your Caddyfile as needed:

my.domain.com {
    tls [email protected]
    gzip
    proxy / localip:8123 {
        websocket
        transparent
    }
}
1 Like

I came across that a couple of nights ago when I was looking at popular docker containers… thanks, having another look at it now.

You could serve from one hundred and two if you like. A reverse proxy will merely redirect that traffic, through the backend, to whatever service you are running. It doesn’t have to be on localhost, it can literally be anywhere, as long as it is reachable via IP or Hostname.

1 Like

@ruiner17 Do you run Caddy on a pi? I’m just looking through available installs now and I’m not seeing pi compatible ones… :thinking: The official site has them, but I’m specifically wanting to stick with docker…

I do run Caddy on a pi2. I didn’t run the docker container, but rather installed it on top of raspbian. I think I followed this guide: