As I’ve been talking about over on the Newbie group, I’ve wanted to get NGINX setup as a reverse proxy over Apache since NGINX provides superior performance in most cases, but Apache does a better job of handling Perl FCGI (and also maintains some other expected behavior, since has .htaccess files).
I’ve created a Perl script that can be invoked on server changes to keep NGINX in sync with Apache. Proxying, of course, requires moving Apache to a different set of ports (I went with 81 and 444). All of this works just as I hoped, but causes Virtualmin’s links to virtual servers to include those (internal only) ports in the URLs (which don’t work, since they aren’t externally exposed). Is there some way to override how Virtualmin displays links to servers so as to mask the fact that internally Apache is listening to a different set of ports?
I’m going to release the script for anyone else who might find it beneficial once I work out all the quirks I can. It has some useful features, I think, including a way to manually refresh one or all virtual servers.
On this same theme, my script has a toggle for turning on and off the proxy. Does the AP allow one to switch templates’ web_ports? I found the templates in /etc/webmin/virtual-server/templates, and could just modify them directly, but I thought there might be a better way to do so via the API, because the files aren’t quite as I’d expect: Virtualmin’s default template (0) is empty, whereas the subserve template (1) has all the configuration settings I’m looking for in it.
And, of course, you can edit the template files in whatever way you’re comfortable with. You don’t have to use the GUI or the CLI, as long as you’re careful about what you put in it. We try to keep configs in plain text, so you can use whatever tools you like to work with them.
Thanks, Joe! Where is the default template’s data stored if not 0? If I look at the query string for editing the template in Virtualmin, it does indeed appear to be template 0, but like I said, that file is empty.
Cloning it and making a new one sounds wise, but if I were to do that, is there a way with the api to find out the current default template and then after cloning it, set the new template to to default? I see the CLI command for cloning, but not for retrieving which template is set to default or setting a new one to be default.