Exposes our RaspberryPi to the web.
- Login to RaspberryPi
- Create account at https://www.dataplicity.com
- Install Dataplicity daemon as per instruction.
- Go to your Dataplicity dashboard and go to your device and enable wormhole.
This will serve as our HTTP server.
- Login to Raspberry Pi
- Go to https://caddyserver.com and download caddy server.
- Create a
caddy.conf
file and add this as content:
0.0.0.0:80 {
proxy / localhost:8123 {
websocket
transparent
}
}
Create systemd service. This will run caddy server on restart.
- Create
caddy.service
file and add this as content:
[Unit]
Description=My Caddy Server
After=network.target
[Service]
ExecStart=/usr/local/bin/caddy -conf caddy.conf
WorkingDirectory=/home/pi
StandardOutput=inherit
StandardError=inherit
Restart=always
User=pi
[Install]
WantedBy=multi-user.target
- Copy
caddy.service
file to this location:
sudo cp caddy.service /lib/systemd/system/caddy.service
- Try starting the service:
sudo systemctl start caddy.service
- If all is good. Enable it so it will be restarted on reboot.
sudo systemctl enable caddy.service