Containerised Web Server using NGINX and SSH
So my son Joe, 12, wants to learn HTML, python, CSS and java….so I wanted to build him a web server he can use as a test bed. Initially I just built him an EC2 instance on t2.micro using the free tier. This was until I realised that my free allowance had run out and it was costing me around £15 per month. £180 per yr for a tiny web server to host a couple of pages seemed a bit too much IMHO, so I decided to build him a container with nginx and SSH and host it on my k8s cluster.
I looked far and wide and couldn’t find something that fit exactly what I wanted, so I just decided to build it instead.
Using a base of Ubuntu and installing sshd, nginx and a few other tools will allow him to do most things he wants. I did opt initially to run just password based ssh and sudo (with sudoers no passwd) initially during the test phase for debugging, which I will remove later on. It will then be public key only and no sudo access for security.
The startup script to start sshd and nginx can be seen at the bottom:
I just deployed the container to k8s with no persistent storage as he keeps the source files on his laptop and can copy them up via filezilla if I reboot the server. Access is via an nginx reverse proxy and SSL with ssh on a very non-standard port.
Should keep him busy for a while.