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

54 lines
1.2 KiB
Nix
Raw Normal View History

2022-09-10 08:15:03 +02:00
{ stdenv
, pkgs
, utils
}:
{ user ? "http"
, group ? "http"
2022-09-15 05:46:14 +02:00
, configFile ? "/etc/php/php-fpm.conf"
, phpIni ? "/etc/php/php.ini"
2022-09-10 08:15:03 +02:00
}:
{...}:
utils.systemd.mkService rec {
name = "php-fpm";
content = ''
[Unit]
Description=The PHP FastCGI Process Manager
After=network.target
[Service]
Type=notify
2022-09-15 05:46:14 +02:00
# User=${user}
# Group=${group}
2022-09-10 08:15:03 +02:00
PIDFile=/run/php-fpm/php-fpm.pid
2022-09-15 05:46:14 +02:00
ExecStart=${pkgs.php}/bin/php-fpm --nodaemonize --fpm-config ${configFile} --php-ini ${phpIni}
2022-09-10 08:15:03 +02:00
ExecReload=/bin/kill -USR2 $MAINPID
RuntimeDirectory=php-fpm
# ReadWritePaths=/usr/share/webapps/nextcloud/apps
# ReadWritePaths=/usr/share/webapps/nextcloud/apps
# ReadWritePaths=/usr/share/webapps/nextcloud/config
# ReadWritePaths=/etc/webapps/nextcloud
LockPersonality=true
NoNewPrivileges=true
PrivateDevices=true
PrivateTmp=true
ProtectClock=true
ProtectControlGroups=true
ProtectHome=true
ProtectHostname=true
ProtectKernelLogs=true
ProtectKernelModules=true
ProtectKernelTunables=true
ProtectSystem=full
RestrictAddressFamilies=AF_INET AF_INET6 AF_NETLINK AF_UNIX
RestrictNamespaces=true
RestrictRealtime=true
RestrictSUIDSGID=true
[Install]
WantedBy=multi-user.target
'';
}