How to setup Seafile with Caddy on NixOS
This is going to be a more simplified and approachable way on how to set up Seafile with Caddy on NixOS.
In the documentation of Seafile in NixOS, they use nginx as a reverse proxy. But as nginx and caddy are somehow not compatible with each other (I assume because both want to access ports 443 and 80).
Here is the rewritten configuration for Caddy in NixOS, which is fully compatible and easier to understand:
"seafile.cashmere.rs" = {
extraConfig = ''
# Seafile Fileserver
handle_path /seafhttp/* {
uri strip_prefix /seafhttp
reverse_proxy unix//run/seafile/server.sock {
header_up X-Forwarded-For {http.request.remote}
transport http {
read_timeout 36000s
write_timeout 36000s
}
}
}
# Seahub Webinterface
reverse_proxy unix//run/seahub/gunicorn.sock {
header_up Host {http.request.host}
transport http {
read_timeout 1200s
}
}
'';
};
Happy Hacking!