Nginx on webmin in front of virtualmin apache vhosts

I have one IP address but several physical servers.
So the thing to do is add a reverse proxy to pass the traffic to the right machines. So far so good.

Now I do have one (but more in future) machine(s) running webmin/virtualmin.
Awesome thing I can run multiple domains and have virtualmin handle the letsencrypts where applicable.

But not when behind nginx… as I learned the nginx reverse proxy needs the certificates on the reverse proxy itself to be able to pass the traffic.

Now the virtualmin has no problems updating the certs every 90 days… but I would like to automate the certs to be moved to the nginx reverse proxy for use.

Now maybe my approach is not the right one or there are better ways to do so, please let me know.

internet
-> router portforwarding 80 and 443 to nginx reverse proxy
–> nginx reverse proxy having the certs passing traffic to virtualmin vhosts port 80 (192.168.x.2)
—> domain.com (192.168.x.10 shared IP on Virtualmin_1)
—> another.com (192.168.x.10 shared IP on Virtualmin_1)
—> yetanother.com (192.168.x.11 shared IP on Virtualmin_2)
—> anymore.com (192.168.x.11 shared IP on Virtualmin_2)

I hope this explains a little… looking forward to read some good ideas. Tx.

I think I may have found some way. I hope this is a proper approach.

when clustering servers, there is an option of cluster copy.
the copy can be scheduled like a cron job.
am I correct they end up as /etc/webmin/cluster-copy/copies/1234567890.copy ?

if so this could be scripted I assume? if so I could create a custom script to run on host creation (and change -> “virtualmin configuration -> actions upon server and user creation”)

workflow:

  • create virtualmin apache host triggers script
  • script creates cluster copy script to copy ssl certs to webmin/nginx
  • copied files end up at webmin/nginx and can be used.

Correct?