Dataplicity Developer Hub

Dataplicity Documentation

Here you'll find announcements for new features and comprehensive guides to help you integrate Dataplicity into your Raspberry Pi projects.

Get Started    

Host a website from your Pi

Host websites, control panels and device APIs at <yourdevice>.dataplicity.io

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.


Overview

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:


Install a web server

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.


Access your Website

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:

https://ABCD-EFGH-1234-device.dataplicity.io/

Where the 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!


❗️

Security considerations

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 3 months ago

Host a website from your Pi


Host websites, control panels and device APIs at <yourdevice>.dataplicity.io

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.