Caddy: Difference between revisions
Caddy with FrankenPHP plugin |
the version of Caddy in nixpkgs stable has HTTP/3 enabled by default |
||
| (5 intermediate revisions by one other user not shown) | |||
| Line 1: | Line 1: | ||
[https://caddyserver.com/ Caddy] is an efficient, HTTP/2 capable web server that can serve static and dynamic web pages. | [https://caddyserver.com/ Caddy] is an efficient, HTTP/2 and HTTP/3 capable web server that can serve static and dynamic web pages. | ||
It can also be a reverse proxy to serve multiple web services under one server. Its main features are its simple config setup and automatic HTTPS: It will automatically request and renew a LetsEncrypt certificate so that users of your service get a Browser-trusted and secure connection. | It can also be a reverse proxy to serve multiple web services under one server. Its main features are its simple config setup and automatic HTTPS: It will automatically request and renew a LetsEncrypt certificate so that users of your service get a Browser-trusted and secure connection. | ||
| Line 9: | Line 9: | ||
enable = true; | enable = true; | ||
virtualHosts."localhost".extraConfig = '' | virtualHosts."localhost".extraConfig = '' | ||
tls internal | |||
respond "Hello, world!" | respond "Hello, world!" | ||
''; | ''; | ||
| Line 89: | Line 90: | ||
You'll need a [[Phpfpm|PHP-FPM]] socket listening on Unix socket path <code>/var/run/phpfpm/localhost.sock</code>. | You'll need a [[Phpfpm|PHP-FPM]] socket listening on Unix socket path <code>/var/run/phpfpm/localhost.sock</code>. | ||
=== PHP | === PHP support using FrankenPHP plugin === | ||
Instead of Caddy, the FrankenPHP package can be defined as drop-in replacement for the Caddy-service which will allow serving PHP applications without additional external process managers. In case you want to use FrankenPHP as an additional Caddy plugin, you can try this modifications | Instead of Caddy, the FrankenPHP package can be defined as drop-in replacement for the Caddy-service which will allow serving PHP applications without additional external process managers. In case you want to use FrankenPHP as an additional Caddy plugin, you can try this modifications | ||
| Line 126: | Line 127: | ||
package = pkgs.caddy.withPlugins { | package = pkgs.caddy.withPlugins { | ||
plugins = [ | plugins = [ | ||
"github.com/dunglas/frankenphp@v1.12.1" | "github.com/dunglas/frankenphp/caddy@v1.12.1" | ||
]; | ]; | ||
hash = "sha256- | hash = "sha256-WWUg717C7VcW7hNDpyoMdNE37JXgyvEU0vmMtZQXFSY="; | ||
}; | }; | ||
virtualHosts." | virtualHosts."localhost".extraConfig = '' | ||
tls internal | |||
respond "Hello, world!" | respond "Hello, world!" | ||
''; | ''; | ||