Dataplicity Wormhole allows you to host a website from your Raspberry Pi, regardless of where it is installed, at a specific address (https://< your device >.dataplicity.io/). Port forwarding, firewall exceptions and Dynamic DNS are no longer required. See how it works here.
In this example we're going to install a very popular web server called NGINX (pronounced "Engine-X" - any other web server will do). This is just a quick demo to get up-and-running. The resulting website does not have much utility, you'll want to replace it with your own project later.
Please ensure the following before proceeding:
- Pi is connected to the internet.
- Dataplicity is installed.
- We are logged in as Pi user.
- Port 80 is free.
Type the following into your Pi terminal and wait for the installation to finish:
sudo apt install -y nginx
NGINX should start automatically, immediately after installation.
Having completed the steps above we're now ready to use Wormhole to access Nginx content. Normally, to access our wormhole we will find its link in our device's options pane. The link will be displayed once you activate the wormhole button.
Using our wormhole link that will look similar to:
ABCD-EFGH-1234 part will be unique to our account. We enter this link in our browser ant the Nginx website will be visible.
The website above is actually running on your Pi. The files for it, and the code for it, are all in the Pi. And if you remove your Pi from your home network and take it to a hackathon, the website link is still the same!
When you switch on Wormhole you are placing the web service hosted on your Pi directly on the wider internet. That's actually the point, but what it means is that you need to take special care in what you put online.
In this case, NGINX is running on port 80 directly from your Pi. Wormhole listens only on localhost, so you don't need to have port 80 open directly from your Pi to the wider world - even though this is not inherently insecure.
Just to avoid confusion it's sensible to close the device port by installing a firewall. Depending on your application you may also wish to enable HTTP basic-authentication from the NGINX configuration, and require a password for website access.
We've put together some basic tips for Securing Wormhole - well worth a read.
Updated 11 months ago