1
0
Fork 0
selfhostblocks/php-fpm/siteconfig.nix

55 lines
1 KiB
Nix
Raw Normal View History

2022-09-10 08:15:03 +02:00
{ stdenv
, pkgs
, utils
}:
2022-09-15 05:46:14 +02:00
{ phpConfigDir
, siteConfigDir
2022-09-10 08:15:03 +02:00
, service
, serviceRoot ? "/usr/share/webapps/${service}"
, user
, group
, siteSocket
, allowedClients ? "127.0.0.1"
, socketUser
, socketGroup
, statusPath ? "/status"
, maxChildren ? 5
, startServers ? 2
, minSpareServers ? 1
, maxSpareServers ? 3
}:
2022-09-15 05:46:14 +02:00
{ ... # Depends on whatever
}:
2022-09-10 08:15:03 +02:00
utils.mkConfigFile {
name = "${service}.conf";
dir = siteConfigDir;
content = ''
[${service}]
2022-09-15 05:46:14 +02:00
user = ${user}
group = ${group}
2022-09-10 08:15:03 +02:00
listen = ${siteSocket}
listen.allowed_clients = ${allowedClients}
2022-09-15 05:46:14 +02:00
listen.owner = ${socketUser}
listen.group = ${socketGroup}
2022-09-10 08:15:03 +02:00
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
chdir = ${serviceRoot}
pm = dynamic
pm.max_children = ${builtins.toString maxChildren}
pm.start_servers = ${builtins.toString startServers}
pm.min_spare_servers = ${builtins.toString minSpareServers}
pm.max_spare_servers = ${builtins.toString maxSpareServers}
catch_workers_output = yes
pm.status_path = ${statusPath}
'';
}