43 lines
1.1 KiB
Nix
43 lines
1.1 KiB
Nix
{ pkgs, lib, config, ... }:
|
|
let
|
|
app = "stjohnscccc";
|
|
domain = "${app}.chandlerswift.com"; # TODO
|
|
dataDir = "/srv/www/http/${domain}";
|
|
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
|
|
encode zstd gzip
|
|
file_server
|
|
php_fastcgi unix//run/php/php-fpm.sock
|
|
log
|
|
'';
|
|
users.users.${app} = {
|
|
isSystemUser = true;
|
|
createHome = true;
|
|
home = dataDir;
|
|
group = app;
|
|
};
|
|
users.groups.${app} = {};
|
|
systemd.tmpfiles.settings."10-stjohnscccc.org" = {
|
|
"/srv/www/stjohnscccc.org" = {
|
|
d = {};
|
|
};
|
|
};
|
|
}
|