Caddy: Difference between revisions
(Began the Caddy wiki article) |
(Added Controlling Caddy section) |
||
Line 20: | Line 20: | ||
Upstream provides [https://caddyserver.com/docs/caddyfile Caddyfile configuration documentation]. | Upstream provides [https://caddyserver.com/docs/caddyfile Caddyfile configuration documentation]. | ||
Here is a simple Caddyfile hosting the site at localhost:2020: | |||
{{Cmd|{ | |||
http_port 2020 | |||
} | |||
localhost:2020 | |||
file_server}} | |||
== Controlling Caddy == | |||
=== Start Caddy === | |||
After the installation Caddy is not running. To start Caddy, use start. | |||
{{Cmd|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): | |||
{{Cmd|# rc-update add caddy}} | |||
Edit the configuration in {{Path|/etc/caddy/Caddyfile}} and run | |||
{{Cmd|# rc-service caddy restart}} | |||
to enable your changes | |||
== See Also == | |||
* [https://caddyserver.com/ Caddy Homepage] | |||
[[Category:Web Server]] |
Latest revision as of 15:32, 18 September 2024
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