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

47 lines
1,005 B
Nix
Raw Normal View History

2023-01-15 06:51:11 +01:00
{ pkgs
, siteName
, logLevel ? "notice"
, siteRoot ? "/usr/share/webapps/${siteName}"
2022-09-10 08:15:03 +02:00
, user
, group
, siteSocket
, allowedClients ? "127.0.0.1"
, socketUser
, socketGroup
, statusPath ? "/status"
, maxChildren ? 5
, startServers ? 2
, minSpareServers ? 1
, maxSpareServers ? 3
2023-01-15 06:51:11 +01:00
}: pkgs.writeText "php-fpm-${siteName}.conf" ''
[global]
error_log = syslog
syslog.ident = php-fpm
log_level = ${logLevel}
2022-09-10 08:15:03 +02:00
2023-01-15 06:51:11 +01:00
[${siteName}]
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
2023-01-15 06:51:11 +01:00
chdir = ${siteRoot}
2022-09-10 08:15:03 +02:00
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}
2023-01-15 06:51:11 +01:00
''