Whenever I create a new virtual (sub) server in virtualmin it makes changes to the Virtualmin Nginx config. This causes proxy websites created outside of Virtualmin to cease functioning. I have no idea why this is happening. I hope someone here might know more about the issue.
I use Nginx almost exclusively and have several “sub servers” all set up through Virtualmin and all appear to be operating (so no issue with their configuration)
The issue is, I have other Nginx configurations that I have outside of Virtualmin (For example webmin and a software panel application) and all of them stop being accessible when the Virtualmin configuration is applied.
I never import configurations from “outside” virtualmin - only altering from within virtualmin
ditto for “proxy sites” Web Configuration -> Edit Proxy Website and Web Configuration -> Proxy Paths
Apologies, I made myself unclear, I think. I am not sure how to explain my problem because I myself have no idea what is going on. I created some Nginx sites before I installed Virtualmin. And these websites that I made prior to using Virtualmin don’t work anymore when a virtual server is configured (Or more specifically, when the Nginx configuration is created and applied). There are some services that I don’t wanna associate with my Virtualmin user, that is why I don’t just make all of the subdomains using Virtualmin.
Virtualmin is an integrated solution. It will know nothing of things you create outside it.
If you didn’t install on a clean system using the install script then you are pretty much on your own. VM doesn’t ‘backwards incorporate’ other existing configurations.
VM is highly configurable so it is possible you can still do what you want from withing VM. Can you give an example of what services you are talking about?
Documentation tells you not to do that. Documentation very clearly says to start with a freshly installed supported OS.
It’s pretty easy to have virtual hosts other than those managed by Virtualmin, but I guess it’s also easy to configure it wrong…in a way that nginx will never choose it over a Virtualmin-created virtual host. You should probably show us what configuration you made that isn’t working, so we can tell you how to make it work.
That’s not true at all. Virtualmin parses config files directly, it does not work from a separate set of configuration (except where necessary for extra metadata about how separate services work together). You can edit config files outside of Virtualmin without problem.
OP just got the configuration wrong. No big deal. If they’ll show us the configuration that’s not working, we can help them fix it.
Not sure if that matters since I am new to Nginx, but all of the other configs that stop working use the proxy_pass directive. Really sorry, I am a complete noob regarding Nginx.
Also, why turn off logs, the one thing that can help troubleshoot problems?
Wait, what? I… Don’t remember doing this. Maybe my partner disabled it for something and forgot to re-enable it. I didn’t notice that to be honest. I have re-enabled it now.
As for what happens, it says that the certificate is invalid and instead of bringing me to the Webmin dashboard like it should do, it redirects me to the main website on port 80.
This is how the config looks that was generated by Virtualmin, by the way. I forgot to include it above.
I would expect the cert to not be able to renew, because you haven’t excluded .well-known from your proxy rule…so the name webmin.domain.tld can never get a Let’s Encrypt cert (you could also use a commercial cert with a longer expiry which doesn’t require validation in the way Let’s Encrypt validates).
Being specific would be helpful here, though. A cert can be “invalid” in many ways. Is it expired? Is it for another domain?
Also, if Webmin has not been setup to be proxied, it won’t work through a proxy. FAQs | Webmin
My apologies for the delay. I have been busy the last few days and had to put this issue to the back of my mind. As for the invalid certificate, it says ERR_CERT_COMMON_NAME_INVALID, but ONLY if the Nginx config from Virtualmin is active. Furthermore, it doesn’t display the dashboard anymore. I have uploaded images below to show the situation:
So, the cert is for the wrong name, which indicates a problem in your nginx configuration (the cert you’re trying to use for this is not for this name). Are you actually requesting a certificate for webmin.domain.tld? Since you configured this yourself, Virtualmin has no way to know to include that in your Let’s Encrypt requests, you’ll need to add it (or manage certs for these webmin domains yourself with certbot, but Virtualmin can be configured to do it).
If you make these domains managed by Virtualmin, or aliases of existing domains managed by Virtualmin, that’d probably be the easiest way to go about this. You could even add the proxy rules (with a tweak to match only on the hostnames with webmin. in them) in your Server Templates for the nginx config.
So, uh… I just played around with my Nginx configurations with inspirations I got from this post here, and out of curiousity I tried to bind the Virtualmin config specifically to Port 81 and now I can reach all of the sites without problem. I am pretty sure that makes the config worse overall, because I’d imagine having the Nginx config for Virtualmin specifically listen for Port 81 only, opens up a whole new world of issues… maybe? But maybe the knowledge helps with finding the issue.