Nginx Reverse Proxy Set Up Guide – Docker

I just got it working ! Thanks so much @juan11perez for all the hard work done on this and generally for answering and being a kind human being, here’s my config for others’ reference :

In mosquitto.conf (Mosquitto MQTT broker configuration)

port 1883
protocol mqtt
...
listener 1884
protocol websockets

Additionally, you should map the container port 1884 to external port 1884

In NGINX default conf

server {
   server_name mqtt.obenita.duckdns.org;
   listen 443 ssl;

  location / {
      proxy_pass http://10.0.0.9:1884/; # The server you want to redirect to
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "upgrade";
  }

}

The configuration in OwnTracks would be then :

  1. Host name - mqtt.yourdomain.duckdns.org
  2. TLS enabled
  3. Websockets enabled, port is 443 (NGINX port)
  4. Authentication - depends on what was previously configured

Thanks @rbray89 for the guidance in one of your replies to this post

2 Likes