oss.zone

website

your user page is available at

static sites#

files are served from the ~/public/html directory.

static site generators#

it's recommended to keep the source files for sites outside of ~/public/html.

CGI scripts#

the following file extensions are dynamically executed:

any files placed in ~/public/html/cgi-bin will be executed regardless of their extension. make sure you use #!/usr/bin/env <interpreter> as the shebang, make the script executable, and send the Content-Type header first.

you can also name a script index.cgi to handle all requests under a path:

take a look at some CGI script examples if you need help.

UNIX sockets#

*-username.oss.zone is served over a UNIX socket at ~/public/http.sock, so you can run a reverse proxy like Caddy to host multiple domains or even services on your sub-domain.

basic example#

{
  admin off
  default_bind unix/{env.HOME}/public/http.sock|0666
}

http://test {
  respond "hi!"
}

http://ip {
  respond "{header.X-Forwarded-For}"
}

keeping it running#

you could just caddy run with a terminal multiplexer of your choice to keep the service running, but the best way is to create a systemd user service.

this service uses the Caddyfile in your home directory.

$ mkdir -p ~/.config/systemd/user

$ cat > ~/.config/systemd/user/caddy.service << EOF
[Service]
ExecStart=/run/current-system/sw/bin/caddy run --config %h/Caddyfile
Restart=on-failure
                                                                    
[Install]                                                 
WantedBy=default.target
EOF

$ systemctl --user daemon-reload
$ systemctl --user enable caddy --now