Issue with setting up Proxy sites / Can't ping Host from VM

SYSTEM INFORMATION
OS type and version Debian Linux 12
Virtualmin version 7.30.8 Pro

I recently upgraded the host for my Virtualmin VM, which wound up hosing the VM entirely. I’m in the process of recreating my VM from scratch, and restoring the sites and proxies I had running on it.

My old setup was on Rocky, but this time I went with Debian as I have several other devices in my home that also run Debian - I figured it would make sense to get everything all on the same distribution to make life easier.

Virtualmin is installed, and up and running for most of my sites. The challenge I am currently running into is Proxies - I created some servers (sub-servers / domains, to be precise), and enabled proxying to the apps I have running in Docker on my host. I know the apps are running, as I can browse to them via ip / port. But when I browse to them via URL from my Virtualmin server, I get a 503 Error - “Service Unavailable: The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.”

I get the feeling I am missing something simple as I just built this server out from a base OS. Is there something I am missing to enable Proxy sites in VM, other than having VM Pro and configuring the Proxy Path for the site?

I’m pretty limited in my web server skills but I use discourse and run this. There is some special setting to do sockets and I didn’t really understand it when I set it up. This was for Discourse and there was an example in the last configs I saw though.

That’s how they are set up on my end, too - that being said, I’m running into another issue that’s also generating 503’s, so something else may be going on. I’ll start a new thread for that issue, and see if that helps.

Different services often have different requirements to make them work.

Also try setting it to the IP:Port if you say that works instead of using “localhost”.

Also look at the log file to see what a more detailed error may be.

some variations that are sometimes required but not always:

(ignore my IPs).

ProxyPass / http://192.168.0.5:5636/
ProxyPassReverse / http://192.168.0.5:5636/

RequestHeader set X-Forwarded-Proto expr=%{REQUEST_SCHEME}
RequestHeader set X-Real-IP expr=%{REMOTE_ADDR}

RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]
RewriteRule ^/?(.*) "wss://127.0.0.1:9443/$1" [P]
SSLProxyCheckPeerName off
SSLProxyCheckPeerCN off
SSLProxyCheckPeerExpire off
SSLProxyEngine on

or

RewriteCond %{HTTP:Upgrade} =websocket
RewriteRule /(.*) ws://127.0.0.1:3001/$1 [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket
RewriteRule /(.*) http://127.0.0.1:3001/$1 [P,L]

these are just examples of when sockets might be required.

also see this sometimes:

ProxyPreserveHost On

the first step is always to test it it works without proxy.

This may be a local networking issue - I just realized I can’t ping my Host’s IP from within the VM.

This is my Networking information inside Virtualmin. It’s a VM that is hosted on a TrueNAS system, and it’s assigned an IP of 10.0.0.240. I can resolve it, ping it, etc. from the outside, and the VM can reach sites outside my network without issue (i.e. - I can pull down updates, scripts, etc.). The one thing I can’t do is ping the host TrueNAS at 10.0.0.253

If your user is in a chroot, you have to use the address. I don’t remember the details, but even if you copy /etc/hosts into the chroot (which most people don’t think to do), it still misbehaves. I know Ilia and I spent a bunch of time understanding this problem, but I have completely forgotten the specifics. The short answer is: If you use chroot jails for your users, you need to use 127.0.0.1 in your proxy rules and in anything within the chroot that needs to talk to localhost.

So, here’s the challenge… I can’t ping the host (10.0.0.253) from inside the VM running Virtualmin (10.0.0.240).

I think the proxy issue is a symptom of a larger issue, which is networking. The VM can talk to the outside world, just not its own host for some reason.

I made a test VM and installed Debian from scratch, and nothing else. From that VM, I can ping my router, but not the host, so the issue is not Virtualmin. I’ll work to get this resolved over on the TrueNAS forums, then come back here to confirm when it’s done.

1 Like

This wound up being a configuration issue with the NIC / Bridge used to set up the VM that Virtualmin is running on. It’s resolved now, and we’re back in business.

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.