I’ve been developing a small, free/open source tool to make using NGINX as a caching proxy easier on Virtualmin. There’s still a lot I would like to do – particularly add a GUI control and make it a full fledged Virtualmin plugin – but it is already functional for anyone who wants to use NGINX in front of Apache.
tl; dr: syncNginxProxy is a tool that can be invoked using via Virtualmin’s post-server modification hook or manually via a CLI to keep NGINX in sync with the Apache configuration that Virtualmin handles in a LAMP install, automagically serving via NGINX true static content, caching static output from dynamic tools and passing along requests for no cache
content.
Rationale: Migrating from cPanel (or Plesk or DirectAdmin) where NGINX proxy is the (newer) norm, it can be hard to choose between NGINX (and its speed/handling of heavy loads) and Apache (more flexibility and compatibility with what users expect).
Apache behind an NGINX proxy can serve orders of magnitude more requests than Apache alone without having to make a full migration to NGINX. Particularly for myself, I depend heavily on mod_fcgid
for autospawning Perl code that is FCGI enabled and I haven’t been able to replicate that functionality on NGINX.
Requires: A Virtualmin LAMP stack on Debian 12. Presently, it expects directories in the locations Debian places them. It probably also works with the current releases of Ubuntu, which I believe follows the same structure. I plan to address this more generally so it can also run on RHEL-derived distributions in the future, and this could be worked around easily enough in the present, by symlinking Apache configuration so that sites are placed in /etc/apache2/sites-[enabled|available]
.
Caution: I’m using this with live users’ sites right now, although you should test it heavily in your own environment before using it with production data. In particular, because it clears parts of the NGINX configuration at times, back up any existing NGINX before using it. It also modifies Apache configuration files upon enabling/disabling, so back up your Apache configuration too.