Host a website on the Pubnix

From Project Segfault Wiki
Revision as of 16:51, 23 January 2023 by Aryak (talk | contribs) (Update info)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The basics

So you have a website and you want to host it. Great! Let's get started.

First of all, we use Caddy for web server because of its simplicity. You can install any web server you want using the Nix package manager.

By default, we have a caddy server running with the configuration in ~/Caddyfile.

We also have a few QoL aliases such as rc (reload caddy), ft (format Caddyfile), vt (validate Caddyfile).

The caddyserver listens on `~/.webserver.sock`.

Any webserver you install needs to listen on `~/.webserver .sock`. Else it will not be recognized by the master caddyserver.

The default caddy configuration checks ~/public_html for static files.

Additionally, it also supports PHP with a php8.2 FPM instance running on the pubnix.

Every user also gets access to *-username.p.projectsegfau.lt for hosting more applications.

For example, you can host your own webapp on mywebapp-username.p.projectsegfau.lt, while your main website is on username.projectsegfau.lt.

To create a new configuration for a subdomain, just append the following to the Caddyfile.

http://webapp-username.projectsegfau.lt {
    bind unix/.webserver.sock
    reverse_proxy localhost:port
}