Hosting a website behind a NAT


So, for a long time, I have wanted to be able to host a publicly viewable website from my machines @ home, but I have been prevented from doing so because I am behind a NAT. For those of you not in the know, being behind a NAT is the typical setup for internet providers. They give you a modem of some sort which connects you to their network in one of thei addresses and they then forward your traffic to the internet proper. What that means is your computer address is not really itself on the internet. Tzo further complicate things, if you also have a persona router hooked up like I do that assigns its own addresses which further obfuscates your connection from the internet.
To get past these things you can use a “localhost tunneling solution” which basically creates a tunnel through all that mess from your local machine to an endpoint that is reachable on the internet – so you can host your own website or other service. I wanted to try using one of these to push content to the web so I set out researching which companies proivided this kind of service. As it turns out there are quite a few now. The gold standard, it seems, is one called Ngrok, however, ever the cheapskate I am, I needed some comparative shopping which landed me here where I saw PageKite which seemed to have great features (like not just http/s connections) and was cheaper for paid plans than Ngrok. Winner winner chicken dinner!
Raspberry Pi Enter the Raspberry PI. I had a few of these laying around and I though one would be fantastic to try this new tunnel provider on and host a static web page to try it with. I set about inatlling Raspberry Pi OS and then apache2 and a cute little web page with the Grumpy Cat (above). Once that was running I added the PageKite software (which is very easy), set up my PageKite account (required) and picked a subdomain (http://66block.pagekite.me/) and I was up and running. Brilliant!
Until……………..
My new website stopped working. This took only minutes. I was so frustrated. No matter what I did, the website would stop working after a couple minutes. I figured for sure this was some kind of issue with PageKite and they just didn’t hold a persistent connection. I fiddled with settings for hours until it dawned on me that I was using the wireless connection on my raspberry pi to host all this stuff and my raspberry pis are notoriously slow when connecting to them wirelessly. The raspberry pi’s wireless connection was what was failing me and not holding a persistent connection, which was causing the PageKite software to fail. I moved the website and PageKite to a virtual machine I have been testing (Oracle Linux) and my PageKite test site has been running now for over 24 hours just fine. Eureka!
** Note: I do want to mention that this ONLY appears to be a problem with *wireless* on the raspberry pi. I have another raspberry pi which is connected via ethernet cable currently running my nertwork storage and it is always immediately accessible.

Comments are closed.