2024-10-31 00:55:10 -05:00
|
|
|
{ pkgs, lib, config, ... }:
|
|
|
|
let
|
|
|
|
app = "stjohnscccc";
|
|
|
|
domain = "${app}.chandlerswift.com"; # TODO
|
2024-11-06 01:22:11 -06:00
|
|
|
dataDir = "/srv/www/stjohnscccc.org";
|
2024-10-31 00:55:10 -05:00
|
|
|
in {
|
|
|
|
services.phpfpm.pools.${app} = {
|
|
|
|
user = app;
|
|
|
|
settings = {
|
|
|
|
"listen.owner" = config.services.caddy.user;
|
|
|
|
"pm" = "dynamic";
|
|
|
|
"pm.max_children" = 32;
|
|
|
|
# "pm.max_requests" = 500;
|
|
|
|
"pm.start_servers" = 1;
|
|
|
|
"pm.min_spare_servers" = 1;
|
|
|
|
"pm.max_spare_servers" = 4;
|
|
|
|
"php_admin_value[error_log]" = "stderr";
|
|
|
|
"php_admin_flag[log_errors]" = true;
|
|
|
|
"catch_workers_output" = true;
|
|
|
|
};
|
|
|
|
# phpEnv."PATH" = lib.makeBinPath [ pkgs.php ];
|
|
|
|
};
|
|
|
|
services.caddy.virtualHosts.${domain}.extraConfig = ''
|
|
|
|
root * ${dataDir}/public
|
2024-11-06 01:22:11 -06:00
|
|
|
|
|
|
|
handle /downloads/* {
|
|
|
|
file_server {
|
2024-11-06 01:44:04 -06:00
|
|
|
browse ${./caddy-browse-template.html}
|
2024-11-06 01:22:11 -06:00
|
|
|
hide .gitignore
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
handle {
|
|
|
|
encode zstd gzip
|
|
|
|
php_fastcgi unix/${config.services.phpfpm.pools.${app}.socket}
|
|
|
|
file_server
|
|
|
|
}
|
|
|
|
|
|
|
|
handle_errors {
|
|
|
|
respond "{err.status_code} {err.status_text}"
|
|
|
|
}
|
2024-10-31 00:55:10 -05:00
|
|
|
'';
|
|
|
|
users.users.${app} = {
|
|
|
|
isSystemUser = true;
|
|
|
|
home = dataDir;
|
|
|
|
group = app;
|
|
|
|
};
|
|
|
|
users.groups.${app} = {};
|
|
|
|
systemd.tmpfiles.settings."10-stjohnscccc.org" = {
|
2024-11-05 23:48:09 -06:00
|
|
|
"/srv/www/stjohnscccc.org" = {
|
2024-10-31 00:55:10 -05:00
|
|
|
d = {};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|