Skip to content

Host a site

You need a machine with a public IP address, with port 6767 open and the CLI installed on it.

Terminal window
sonion cert --host <your-ip> --out ./certs

This writes certs/cert.pem and certs/key.pem, and prints the certificate’s fingerprint.

Terminal window
sonion serve --root ./my-site --cert certs/cert.pem --key certs/key.pem

Your folder needs an index.html. Keep this running with systemd, tmux etc.

Terminal window
sonion register --username you --password "something long"
sonion login --username you --password "something long"

login prints an API key. Use it in the next step.

Terminal window
sonion put-domain yourname.son --api-key <key> --endpoints <your-ip>:6767 --cert certs/cert.pem

The --cert flag matters. It publishes your certificate’s fingerprint in the domain record, so browsers can trust your self-signed certificate. Without it, your site won’t open.

Go to sonion://yourname.son in the browser.

Use a full sonion:// address:

<a href="sonion://other.son/">Another site</a>

Links and GET forms work this way. On Windows, images, scripts and fetch calls can’t load from a sonion:// address, so keep those files on your own site and use relative paths.

  • /about/ serves about/index.html, and /about redirects to /about/ if that folder exists.
  • A missing path without a file extension serves your root index.html, so single-page apps work.
  • A missing path with an extension returns a 404. Add 404.html to your folder to customise it.
  • Files are limited to 10 MB.
  • Static sites accept GET, HEAD and OPTIONS. For anything else, run a backend.

You can also register and manage domains on the domains.son using its own API instead of the CLI.