Skip to content

Instantly share code, notes, and snippets.

@Christilut
Created January 3, 2024 12:38
Show Gist options
  • Save Christilut/7b009310b44d638db99034d72d8ecee2 to your computer and use it in GitHub Desktop.
Save Christilut/7b009310b44d638db99034d72d8ecee2 to your computer and use it in GitHub Desktop.
Caddy 2 configuration for Sendy
sendy.example.com {
root * /var/www/sendy
encode gzip
file_server
php_fastcgi unix//run/php/php-fpm.sock {
split .php
index index.php
}
try_files {path} {path}.php
# Enable rewrite rules for Sendy
@w path_regexp w ^/w/([a-zA-Z0-9/]+)$
rewrite @w w.php?i={re.w.1}
@l path_regexp l ^/l/([a-zA-Z0-9/]+)$
rewrite @l l.php?i={re.l.1}
@t path_regexp t ^/t/([a-zA-Z0-9/]+)$
rewrite @t t.php?i={re.t.1}
@unsub path_regexp unsub ^/unsubscribe/(.*)$
rewrite @unsub unsubscribe.php?i={re.unsub.1}
@sub path_regexp sub ^/subscribe/(.*)$
rewrite @sub subscribe.php?i={re.sub.1}
# Configure logging (optional)
log {
output file /var/log/caddy/sendy.log
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment