TrueNAS Scale & NGINX reverse proxy & VM - 502 error

unholyeyebrows

Explorer
Joined
Apr 19, 2012
Messages
55
Hi All

I have the following set-up:

TrueNAS Scale: host IP: 192.168.68.248
A number of apps running i.e.
NextCloud
Jellyfin

I also have running, as an app, Nginx Proxy Manager to act as a reverse proxy.

For the proxy set-up, I have DuckDNS & Let's Encrypt configured and can successfully access the Nextcloud and Jelyfin servers from the internet using the following Nginx settings:

Jellyfin:

Details:
Domain name: jellyfin.aaa.duckdns.org
Scheme: http
Forward IP: 192.168.68.248
Forward port: 8096
Block common exploits: enabled
Access list: Publicly Accessible

SSL:
SSL Cert: *.aaa.bbb.org
Force SSL: enabled
HTTP/2: enabled
HSTS enabled: enabled

This config, plus equivalent for Nextcloud works perfectly.

Now, I also have Home Assistant running in a VM on the same TrueNAS Scale host at 192.168.68.102:8123 and so have set-up Nginx as follows:

Homeassistant:

Details:
Domain name: homeassistant.aaa.duckdns.org
Scheme: http
Forward IP: 192.168.68.102
Forward port: 8123
Block common exploits: enabled
Websockets Support: enabled
Access list: Publicly Accessible

SSL:
SSL Cert: *.aaa.duckdns.org
Force SSL: enabled
HTTP/2: enabled
HSTS enabled: enabled

However, this does not proxy correctly, and I receive a 502 Bad Gateway error.

I'm assuming the fact the Nginx docker container is not being able to forward to the VM relates to restrictions in the Docker networking, but I cannot work out how to solve this. I have tried editing the Apps -> Advance Settings and have added the following but this then results in a 504 timeout error:

Route v4 Interface: enp1s0
Route v4 Gateway: 192.168.68.1

I'm guessing this is a common scenario - proxying VMs or indeed other physical servers on the LAN using Nginx in a container. Any help would be very gratefully received!

Thanks
 
Last edited:

unholyeyebrows

Explorer
Joined
Apr 19, 2012
Messages
55
I've found a way to solve this by creating a bridge network in TrueNAS and adding this to my VMs. Here are the steps in case anyone needs them:

Network settings:
- Click on current active enp1s0 interface
- Disable DHCP and click save.
- Create new bridge named br0
- Add enp1s0 interface
- Enable DHCP (then reserve 192.168.68.248 in my LAN router).
- Test the change and if OK apply it.
- Finally add br0 as the interface to each VM's NIC.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
Homeassistant
Home Assistant requires some settings in its configuration.yaml file when it's behind a reverse proxy. See:
and
 

kassflute

Cadet
Joined
Jul 14, 2023
Messages
4
I've found a way to solve this by creating a bridge network in TrueNAS and adding this to my VMs. Here are the steps in case anyone needs them:

Network settings:
- Click on current active enp1s0 interface
- Disable DHCP and click save.
- Create new bridge named br0
- Add enp1s0 interface
- Enable DHCP (then reserve 192.168.68.248 in my LAN router).
- Test the change and if OK apply it.
- Finally add br0 as the interface to each VM's NIC.
Hello,
Do you have a source for this procedure of doing a bridge because I have the exact same problem as you but this just make my haos unaccessible ?

thank you
 

samarium

Contributor
Joined
Apr 8, 2023
Messages
192
I believe that the are instructions in the truenas documentation, though I haven't gone looking for it myself.
 

CPT82

Cadet
Joined
May 6, 2022
Messages
4
Hi All

I have the following set-up:

TrueNAS Scale: host IP: 192.168.68.248
A number of apps running i.e.
NextCloud
Jellyfin

I also have running, as an app, Nginx Proxy Manager to act as a reverse proxy.

For the proxy set-up, I have DuckDNS & Let's Encrypt configured and can successfully access the Nextcloud and Jelyfin servers from the internet using the following Nginx settings:

Jellyfin:

Details:
Domain name: jellyfin.aaa.duckdns.org
Scheme: http
Forward IP: 192.168.68.248
Forward port: 8096
Block common exploits: enabled
Access list: Publicly Accessible

SSL:
SSL Cert: *.aaa.bbb.org
Force SSL: enabled
HTTP/2: enabled
HSTS enabled: enabled

This config, plus equivalent for Nextcloud works perfectly.

Now, I also have Home Assistant running in a VM on the same TrueNAS Scale host at 192.168.68.102:8123 and so have set-up Nginx as follows:

Homeassistant:

Details:
Domain name: homeassistant.aaa.duckdns.org
Scheme: http
Forward IP: 192.168.68.102
Forward port: 8123
Block common exploits: enabled
Websockets Support: enabled
Access list: Publicly Accessible

SSL:
SSL Cert: *.aaa.duckdns.org
Force SSL: enabled
HTTP/2: enabled
HSTS enabled: enabled

However, this does not proxy correctly, and I receive a 502 Bad Gateway error.

I'm assuming the fact the Nginx docker container is not being able to forward to the VM relates to restrictions in the Docker networking, but I cannot work out how to solve this. I have tried editing the Apps -> Advance Settings and have added the following but this then results in a 504 timeout error:

Route v4 Interface: enp1s0
Route v4 Gateway: 192.168.68.1

I'm guessing this is a common scenario - proxying VMs or indeed other physical servers on the LAN using Nginx in a container. Any help would be very gratefully received!

Thanks
i'm having a hard time getting either the community or charts Nginx PM to install correctly. the community one would deploy and just get stuck, as for the charts version i got it to actually start. I could ping it but in a browser it would not pull up.

I migrated from core to Scale and was able to get Nginx PM to run find in core, but scale seems to be a challenge for me.
Were you following a guide of some sort. I've gong through some guides as well as YT videos.

I did a fresh install of Trunas Scale so i could rull out any funny settings being upgraded to Scale.

I'm just really tying to get my nextcloud back up and running using Nginx as my proxy with some Lets Encrypt (thats another story) and DuckDNS to play nicely together.

Any help would be appreicated
 
Top