Add Subdomain

Notes after adding docs. subdomain to

Update DNS Entry

  • log in to
  • in domain list press Manage -> select tab Advanced DNS
  • press Add New Record
    • Type A Record
    • Host <subdomain>, like docs
    • IP <Server IP>, like

Create Github Repository

So far my content is always backed by a git repository. Pushing to the repo should update my site.

  • create new repository at
  • add webbhook via Settings -> Webhooks
  • press Add webhook
    • Payload URL<long string>
    • Content type application/json (not sure if it matters here)
  • locally git clone <repo ssh link>
  • modify .git/config as described in this blog post so git uses the correct SSH key

Configure Server


Replace <subdomain> in following snippets.

Log into server ssh <username>

Clone the github repo:

cd ~/github
git clone <repo https link>

Create a script that runs the refresh logic of the webhook / git push. touch ~/refresh_<subdomain>.sh. Content:

set -xe

touch ~/<subdomain>_refresh_calling.txt
cd ~/github/<subdomain>
git pull
npm run docs:build # specific vitepress build cmd
touch ~/<subdomain>_refresh_success.txt

Create a soft link to the build result. Example:

ln -s ~/github/docs/docs/.vitepress/dist/ ~/docs

Test the script manually.

Configure Caddy Webserver

Log into server ssh <username>

Configure file_server to location of files.

  • sudo nano /etc/caddy/Caddyfile
<subdomain> {
  root * /home/caddy/<subdomain>
  try_files {path}.html {path} {path}index.html {path}/index.html index.html
  encode gzip
  log { }
} {
  route {
    # update subdomain
    exec /<long string> sh /home/caddy/refresh_<subdomain>.sh

  • sudo systemctl reload caddy

Test the webhook URL manually and with a git push. Done.