feat: add caddy config files

This commit is contained in:
Julien Oculi 2024-05-21 17:06:22 +02:00
parent e1baf2a538
commit 8eca961a57
3 changed files with 71 additions and 0 deletions

12
caddy/README.md Normal file
View file

@ -0,0 +1,12 @@
# Configuration de `caddy`
Reverse proxy pour cohabit.
## Port
`localhost:80` `localhost:443`
## Emplacements
- `./caddy/*` -> `/etc/caddy/*`
- `./systemd/*` -> `/etc/systemd/system/*`

24
caddy/caddy/Caddyfile Normal file
View file

@ -0,0 +1,24 @@
localhost:80,
cohabit.fr {
# Website entry point
encode zstd gzip
reverse_proxy 127.0.0.1:8000
}
www.cohabit.fr {
# Redirect "www" subdomain to main website entry point
redir https://cohabit.fr{uri} permanent
}
git.cohabit.fr {
# Forgejo instance for cohabit
reverse_proxy 127.0.0.1:10001
}
projets.cohabit.fr {
# Redmine instance for cohabit
reverse_proxy 127.0.0.1:33037
}

View file

@ -0,0 +1,35 @@
# caddy.service
#
# For using Caddy with a config file.
#
# Make sure the ExecStart and ExecReload commands are correct
# for your installation.
#
# See https://caddyserver.com/docs/install for instructions.
#
# WARNING: This service does not use the --resume flag, so if you
# use the API to make changes, they will be overwritten by the
# Caddyfile next time the service is restarted. If you intend to
# use Caddy's API to configure it, add the --resume flag to the
# `caddy run` command or use the caddy-api.service file instead.
[Unit]
Description=Caddy
Documentation=https://caddyserver.com/docs/
After=network.target network-online.target
Requires=network-online.target
[Service]
Type=notify
User=caddy
Group=caddy
ExecStart=/usr/local/bin/caddy run --environ --config /etc/caddy/Caddyfile
ExecReload=/usr/local/bin/caddy reload --config /etc/caddy/Caddyfile --force
TimeoutStopSec=5s
LimitNOFILE=1048576
PrivateTmp=true
ProtectSystem=full
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
[Install]
WantedBy=multi-user.target