How to config Home Assistant OS runs on VM for SSL/HTTPS access. I am getting 502 Bad Gateway nginx

Did you add the /api/websocket part?

Yes I added just like you posted it (ofc change the IP, domain etc).

and the sites-available / sites-enabled config is correct?

The issue is definitely on the Home Assistant end, because the Nginx log shows that it is trying to connect to the correct IP address and the correct port upstream. It’s Home Assistant that is ignoring the connection it seems.

You might need to increase the logging on the http component.

logger:
  logs:
    aiohttp: debug
    homeassistant.components.http: debug

Don’t know if the first or second line will provide the best information…

Ye looks like it is something on the HA side. Sites-avaliable and sited-enabled is fine.

And where do I find the logs now?

EDIT // settings - system - logs showing this

12-27 18:17:10.509 DEBUG (MainThread) [homeassistant.components.http.auth] Authenticated 192.168.0.100 for /api/error_log using bearer token

2023-12-27 18:17:10.510 DEBUG (MainThread) [homeassistant.components.http.view] Serving /api/error_log to 192.168.0.100 (auth: True)

192.168.0.100 - is my computer

And there is also

2023-12-27 18:16:52.780 DEBUG (MainThread) [homeassistant.components.http.view] Serving /api/core/state to 172.30.32.2 (auth: True)

2023-12-27 18:16:52.830 DEBUG (MainThread) [homeassistant.components.http.auth] Authenticated 172.30.32.2 for /api/core/state using bearer token

I do not know what the 172.30.32.2 IP is.

The 172 network is the docker network, that’s normal.

Then I really do not work why is it not working :frowning: nothing special in the logs.

Last thing I am wondering.
What happens if you go into the command line of the Nginx machine - and try pinging the IP address of the Home Assistant machine?

Hmm, interesting. From my personal PC (192.168.0.100) I can ping the HA (192.168.0.73), but from the host linux machine (192.168.0.110):

PING 192.168.0.73 (192.168.0.73) 56(84) bytes of data.
From 192.168.0.110 icmp_seq=1 Destination Host Unreachable
From 192.168.0.110 icmp_seq=2 Destination Host Unreachable
From 192.168.0.110 icmp_seq=3 Destination Host Unreachable
From 192.168.0.110 icmp_seq=4 Destination Host Unreachable
From 192.168.0.110 icmp_seq=5 Destination Host Unreachable

I tried ping a KVM Windows Machine (same host) ping 192.168.0.229 and the host machine cannot even ping this KVM machine?

Hmmm interesting, now we are getting somewhere.
OK So there is a firewall issue or a routing issue going on somewhere then.

Tell us more about what machine is running the actual VMs and what machine is running the docker reverse proxies?

192.168.0.110 is the main server. It is running nginx and also the KVM machines. I think it is something that the official KVM HA created?

So can we see the networking settings for the HA VM? Is it bridge or host? Also what software is running the VM :+1:

The HA is running by linux KVM created in the cockpit panel like this:

image

enp6s0 is the network like my main network, because when I let it to the “virtual LAN” I cannot see it in my router so I cannot port forward to it and I cannot see its IP.

No I think when it’s virtual LAN then the host is responsible for routing to the VM, so the router would need to be set to forward to the Host IP, not the VM IP.

What is the name of the virtualisation software?

KVM - via virt-manager exactly like the official documentation said.

But maybe there is wrong “bridge” created.

Is there the ability to set the interface to virbr0 ?

firewall-cmd --add-port=8123/tcp --zone=libvirt

Also maybe try that - on the host

It is possible to have it on that vibr0 but then the IP is like 192.168.122.87 and I cannot reach that.

No in that case you would be expected to access it via the HOST IP address at port 8123. BUT While that will let you in to Home Assistant, it’s not terribly great for Home Assistant itself which relies on network discovery etc, if it is receiving a rather sandboxed networking experience.

When I set in the virt-manager the NAT so it gives it IP Like 192.168.122.xxx then I can ping from host to KVM and vice-versa bud I cannot ping it from my PC I cannot access it via URL etc…