From 27a1109bedd527cd473e031f0a01177a687810ce Mon Sep 17 00:00:00 2001 From: Marty Date: Tue, 27 Dec 2022 16:15:00 +0100 Subject: [PATCH] adding caddy configuration example (#154) --- src/en/SUMMARY.md | 1 + src/en/administration/administration.md | 4 ++ src/en/administration/caddy.md | 51 +++++++++++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 src/en/administration/caddy.md diff --git a/src/en/SUMMARY.md b/src/en/SUMMARY.md index f9be3af..bb8b332 100644 --- a/src/en/SUMMARY.md +++ b/src/en/SUMMARY.md @@ -15,6 +15,7 @@ - [Getting started with Federation](administration/federation_getting_started.md) - [Troubleshooting](administration/troubleshooting.md) - [Backup and Restore](administration/backup_and_restore.md) + - [Using Caddy as a reverse proxy](administration/caddy.md) - [Moderation](moderation/moderation.md) - [Federation](federation/federation.md) - [Federation Overview](federation/overview.md) diff --git a/src/en/administration/administration.md b/src/en/administration/administration.md index 38e793a..ef43576 100644 --- a/src/en/administration/administration.md +++ b/src/en/administration/administration.md @@ -20,3 +20,7 @@ In some cases, it might be necessary to use different installation methods. But - [From Scratch](from_scratch.md) - [Yunohost](https://install-app.yunohost.org/?app=lemmy) ([source code](https://github.com/YunoHost-Apps/lemmy_ynh)) - [On Amazon Web Services (AWS)](on_aws.md) + +### You could use any other reverse proxy + +An Example [Caddy configuration](caddy.md). diff --git a/src/en/administration/caddy.md b/src/en/administration/caddy.md new file mode 100644 index 0000000..87f5b62 --- /dev/null +++ b/src/en/administration/caddy.md @@ -0,0 +1,51 @@ +# Using Caddy as reverse proxy example + +If you prefer to use Caddy instead of Nginx - you could use this template to fit into your needs: + +``` +(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-site.com { + import caddy-common + reverse_proxy http://lemmy_lemmy-ui_1:1234 +} + +@lemmy { + path /api/* + path /pictrs/* + path /feeds/* + path /nodeinfo/* + path /.well-known/* +} + +@lemmy-hdr { + header Accept application/* +} + +handle @lemmy { + reverse_proxy http://lemmy_lemmy_1:8536 +} + +handle @lemmy-hdr { + reverse_proxy http://lemmy_lemmy_1:8536 +} + +@lemmy-post { + method POST +} + +handle @lemmy-post { + reverse_proxy http://lemmy_lemmy_1:8536 +} +``` \ No newline at end of file