Caddy

From Alpine Linux
Revision as of 15:32, 18 September 2024 by Jahway603 (talk | contribs) (Added Controlling Caddy section)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Caddy is a fast and extensible multi-platform HTTP/1, HTTP/2, and HTTP/3 web server with automatic TLS by default, providing HTTPS on every site.

Intallation

Caddy package is available in the Alpine Linux repositories. To install it run:

apk update apk add caddy

System scripts

If you are running OpenRC, then you can install those with:

apk update apk add caddy-openrc

If you are running runit, s6, or dinit, (or other), then there are no scripts packaged for your init systems yet. Please feel free to contribute a package with them.

Configuration

Caddy's default config file when using the Artix package is /etc/caddy/Caddyfile.

Upstream provides Caddyfile configuration documentation.

Here is a simple Caddyfile hosting the site at localhost:2020:

{ http_port 2020 } localhost:2020 file_server

Controlling Caddy

Start Caddy

After the installation Caddy is not running. To start Caddy, use start.

rc-service caddy start

Navigate a browser to the machine's address and a page should appear if you have configured /etc/caddy/Caddyfile correctly.

Enable Caddy on startup (if needed):

# rc-update add caddy

Edit the configuration in /etc/caddy/Caddyfile and run

# rc-service caddy restart

to enable your changes

See Also