Day 10: Home Page
Start server
# build
git clone https://github.com/jindongh/home.git
go build app.go
# set up service
cat > /etc/systemd/system/home.service <<EOF
[Unit]
Description=home web site
Wants=network-online.target
After=network-online.target nss-lookup.target
[Service]
Type=exec
Restart=always
RestartSec=1
User=pi
UMask=0000
ExecStart=/home/pi/home/app
[Install]
WantedBy=multi-user.target
EOF
cat > .env <<EOF
PORT=9090
NAME=jindongh
URL_HOME=https://${NAME}.duckdns.org
URL_VIDEO=https://${NAME}-video.duckdns.org
URL_PHOTO=https://${NAME}-photo.duckdns.org
URL_BOOK=https://${NAME}-book.duckdns.org
URL_DOWNLOAD=https://${NAME}-download.duckdns.org
EOF
# start service
sudo systemctl daemon-reload
sudo systemctl start home
sudo systemctl enable home
Test Service
The service should be running at
http://raspberrypi.local:9090
Enable public access
-
Register DNS: .duckdns.org
-
Setup reverse proxy with http://raspberrypi.local:81
Now you can access it from public, like
https://jindongh.duckdns.org