I have a server with Virtualmin / Webmin installed and 5 websites configured.
I would like to have some small Flask python apps running on it and accessible with subdomain of some domain installed.
Imagine I host a php website on www.example.com
and I would like mysmallapp.example.com to link to a python Flask app running on the same server.
How can I do ? can I launch the Flask app on a specific port and make mysmallapp.example.com port 80 go to it ?
Is the Pro Proxypaths feature the solution for my needs ?
What is the easiest solution to do that and configure the good path in Virtualmin without destroying the usual Apache conf ?
Same as always, and same as on any web server (not just one running Virtualmin): Proxy to it.
The Flask documentation provides examples with many web servers, including Apache and nginx (the two that Virtualmin supports). Apache docs are here: Apache httpd — Flask Documentation (2.2.x)
You probably already have mod_proxy enabled and loaded, so you likely only need the ProxyPass and maybe a ProxyPassReverse. Note Flask needs some additional config to run behind a proxy (but that’s a Flask question, covered by their docs, not specific to Virtualmin).
You also probably don’t need the additional headers, I’m not entirely sure why they include that. My only Flask app doesn’t have that.
You may also consider using a named socket rather than a port. If your system is shared, a port is a security risk, because anyone on the local system can connect to it, but a named port can be owned by the domain user/group, which limits what can connect to it. If the system is not shared, this doesn’t matter.
Thanks for your great answer, I’m going to study that with proxies, thanks
This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.