I would like to host several small static websites in Incus servers, but need guidance.
My thought is to connect the servers to the web through Nginx in its own container. But I also understand that Incus has proxy functionality, but documentation is beyond my feeble experience.
Also, would much appreciate web server recommendations.
Many thanks,
LRP
Hi!
The old webhosting practice is to have a single web server and then add the different websites as virtual hosts (Apache terminology) or server blocks (nginx terminology).
Since we now have Incus, and we can get system containers (lightweight VMs), it’s possible to either put each website into its own system container, or at least make them in groups and each group goes in a system container. In that situation, you would create a separate system container that has the role of the reverse proxy, and the reverse proxy would forward connections to the appropriate container for the corresponding website.
The reverse proxy can either run nginx, or haproxy. I suggest to use nginx if you are already familiar.
I have written about that a long time ago, and it’s easy to adapt with Incus, https://www.linode.com/docs/guides/how-to-set-up-multiple-wordpress-sites-with-lxd-containers/
In there I show how to setup WordPress which also requires PHP. In your case you do not need any of these, which means that the task is greatly simplified. Just make sure you do the HTTPS (LetsEncrypt) step properly so that the certificates get updated automatically for you.
Since you do not need PHP (a memory + cpu hog), you can fit more sites on the server.
If you are also familiar with Alpine, use it for the system containers to keep the memory use even lower.
For a dozen static websites and using system containers, you should be able to squeeze into a 2GB RAM server.