Have you looked at WarBerryPi yet? https://github.com/secgroundzero/warberry It seems similar to what you're wanting to end up with.
I know you want to roll your own to learn, so don't just download it and go. Keep working at yours. But if you do get stuck trying to figure something out, have a look at what they've done.