From 290280f71478e89efeddae0e3f9b4c2ef59e8c29 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Fri, 15 Nov 2024 10:51:25 -0600 Subject: [PATCH] integrate caddy with nixos instead of docker --- hosts/algiz/Caddyfile | 74 ++++++++++++++++++++++++++++++++++++++++ hosts/algiz/services.nix | 4 +++ 2 files changed, 78 insertions(+) create mode 100644 hosts/algiz/Caddyfile diff --git a/hosts/algiz/Caddyfile b/hosts/algiz/Caddyfile new file mode 100644 index 0000000..3d56599 --- /dev/null +++ b/hosts/algiz/Caddyfile @@ -0,0 +1,74 @@ +elizabeth-and-daylin.com { + reverse_proxy http://localhost:4321 +} + +elizabeth.dayl.in, www.elizabeth-and-daylin.com { + redir https://elizabeth-and-daylin.com{uri} permanent +} + +attic.dayl.in { + reverse_proxy http://localhost:5656 +} + +git.dayl.in { + reverse_proxy http://localhost:3000 +} + +gts.dayl.in { + # Optional, but recommended, compress the traffic using proper protocols + encode zstd gzip + + # TODO: change port? + # The actual proxy configuration to port 8080 (unless you've chosen another port number) + reverse_proxy * http://localhost:3758 { + # Flush immediatly, to prevent buffered response to the client + flush_interval -1 + } +} + +# not currently a running service on algiz +# (caddy-common) { +# encode gzip +# header { +# -Server +# Strict-Transport-Security "max-age=31536000; include-subdomains;" +# X-XSS-Protection "1; mode=block" +# X-Frame-Options "DENY" +# X-Content-Type-Options nosniff +# # Referrer-Policy no-referrer-when-downgrade +# X-Robots-Tag "none" +# } +# } +# +# lemmy.dayl.in { +# import caddy-common +# reverse_proxy http://lemmy-ui:1234 +# +# @lemmy { +# path /api/* +# path /pictrs/* +# path /feeds/* +# path /nodeinfo/* +# path /.well-known/* +# } +# +# @lemmy-hdr { +# header Accept application/* +# } +# +# handle @lemmy { +# reverse_proxy http://lemmy:8536 +# } +# +# handle @lemmy-hdr { +# reverse_proxy http://lemmy:8536 +# } +# +# @lemmy-post { +# method POST +# } +# +# handle @lemmy-post { +# reverse_proxy http://lemmy:8536 +# } +# } diff --git a/hosts/algiz/services.nix b/hosts/algiz/services.nix index e195044..666bab0 100644 --- a/hosts/algiz/services.nix +++ b/hosts/algiz/services.nix @@ -65,4 +65,8 @@ in } ]; }; + + services.caddy = enabled // { + extraConfig = builtins.readFile ./Caddyfile; + }; }