Skip to content

Instantly share code, notes, and snippets.

@Lvdwardt
Last active June 4, 2025 23:49
Show Gist options
  • Save Lvdwardt/707d9c3fb4581d38102399f91a21c9c6 to your computer and use it in GitHub Desktop.
Save Lvdwardt/707d9c3fb4581d38102399f91a21c9c6 to your computer and use it in GitHub Desktop.
Rustdesk + Nginx proxy manager
version: '3'
networks:
rustdesk-net:
external: false
services:
nginx-proxy-manager:
image: 'jc21/nginx-proxy-manager:latest'
restart: unless-stopped
ports:
# These ports are in format <host-port>:<container-port>
- '80:80' # Public HTTP Port
- '443:443' # Public HTTPS Port
- '8081:81' # Admin Web Port
# Add any other Stream port you want to expose
# - '21:21' # FTP
# Ports needed for Rustdesk:
- '21115:21115'
- '21116:21116'
- '21116:21116/udp'
- '21117:21117'
- '21118:21118'
- '21119:21119'
# Uncomment the next line if you uncomment anything in the section
# environment:
# Uncomment this if you want to change the location of
# the SQLite DB file within the container
# DB_SQLITE_FILE: "/data/database.sqlite"
# Uncomment this if IPv6 is not enabled on your host/
# DISABLE_IPV6: 'true'
volumes:
- ./data:/data
- ./letsencrypt:/etc/letsencrypt
networks:
- rustdesk-net
hbbs:
container_name: hbbs
image: rustdesk/rustdesk-server:latest
command: hbbs -r rustdesk.yourDomain.com:21117
volumes:
- ./data:/root
networks:
- rustdesk-net
depends_on:
- hbbr
restart: unless-stopped
hbbr:
container_name: hbbr
image: rustdesk/rustdesk-server:latest
command: hbbr
volumes:
- ./data:/root
networks:
- rustdesk-net
restart: unless-stopped
@okynnor
Copy link

okynnor commented Apr 23, 2025

If you're using a FQDN like rustdesk.your_domain.com, have you added this FQDN to your internal DNS server yet?

If you're using Pi-Hole, Under Settings --> Local DNS Records.
Note to use only the external FQDN.

@hack2spider
Copy link

Im using pihole, but pihole wont route the incoming traffic to my container .. nginx will do ... only using traffic internally unbound. I also have local dns setup for but I`m not sure I can setup external FQDNS into my internal instance as from what I know this will screw everything up.

my rustdesk.external.com domain points to my wan ip and from there ngnix takes traffic where it needs to go via streams ...

Im using 2 nginx instances .. the old one I always had which routes https traffic to the required containers and authelia as required and also using nginx for rustdesk where Im pointing the traffic from my LXC local ip internally to docker bridge network created by rustdesk ...

the setup was working fine until recently

so on my main desktop (as I have a few on my lan) when opening rustdesk all history connections show up fine .. if I log in locally it works ... but the remote ones even if shown with green dot, when I try to connect to them it hangs for a while .. and throws a relay problem ... same when i try to connect from one of them remotec desktops into my own desktop ..

I tried so far :

  1. rebooting all desktops and updating to latest verisons
  2. force-recreated the containers with nginx and rustdesk (the compose file) to make sure the latest containers are downloaded
  3. re-checked the forwarding ports in my unifi
  4. re-checked the firewall rules
  5. rechecked my main ngnix rules

all above looking good, I can connect to all my servers behind the ngnix, Im using quite a few .. its only rustdesk that stopped working

@okynnor
Copy link

okynnor commented Apr 24, 2025

I wouldn't try to use nginx as per the original post has suggested. Routing traffic through nginx, as shown in this post, means that you dont have a router. Most people have a router. Why route traffic twice before it hits the Rustdesk containers?

Simplify is your friend. Remove useless layers of complexity.

Here's what I got going on my home lab.

After traffic hits my router, my router forwards the rustdesk named opened ports to the rustdesk containers

Screenshot 2025-04-24 at 10 02 58 AM

Since you're running Pi-hole, do this:

Screenshot 2025-04-24 at 10 05 09 AM

Yes, it is that simple.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment