The easiest way to access your Raspberry Pi from the web for testing things out (like a simple web server) is to use a service called ngrok. It creates a secure tunnel to your Pi’s locally running server, giving you a simple public URL that you can use to access it from anywhere online.
To install it on your Pi, go ngrok.com, scroll to the “Download and Installation” section and copy the URL of the download link next to “Linux ARM”:
Then, open up your command line/terminal on your Pi and type in the following, where the URL is the URL you copied from above:
You’ll then need to have a way to unzip that file. If you haven’t unzipped anything on your Pi in the past, you’ll need to install the zip package using the following command:
apt-get install unzip
Then unzip ngrok using the following:
That will unzip the file “ngrok” at this location. Run it using the following command (replace “80” with the port you’d like to be able to access):
./ngrok http 80
You should see output that looks like so:
The URL you’ll want will look like “http://0acc59c9.ngrok.io” (ngrok will generate you a unique one, so don’t try this one!). If you enter your URL into wherever you are trying to access your Raspberry Pi from, you should access that service on your Pi, just as if you were accessing it from your local network! Well, not quite as quickly but still quite speedily!
(Note: you do not need to include the port number in that request as ngrok automatically is directing the request to the port you set)
Learn to build for the Amazon Echo, Google Home, Facebook Messenger, Slack & more!