2022-08-18 08:40:39 +02:00
|
|
|
# {{ ansible_managed }}
|
|
|
|
#
|
2023-01-16 16:31:00 +01:00
|
|
|
# This service can be enabled for user.
|
2022-08-18 08:40:39 +02:00
|
|
|
# It uses a single php-fpm configuration file.
|
|
|
|
# User-specific settings can be overridden via environment variables (see "FPM_SOCKET_PATH" below).
|
|
|
|
|
|
|
|
[Unit]
|
|
|
|
Description=The PHP FastCGI Process Manager for %I
|
|
|
|
Documentation=man:php-fpm{{ php_version.stdout }}(8)
|
|
|
|
After=network.target
|
|
|
|
Requires=php-fpm@%i.socket
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
User=%i
|
|
|
|
Group=%i
|
|
|
|
Type=notify
|
|
|
|
Environment="FPM_SOCKETS=/run/php/php-fpm-%i.sock=3"
|
|
|
|
Environment="FPM_ERROR_LOG={{ php_fpm_log_dir }}/%i.log"
|
|
|
|
# this variable is used in the pool configuration file
|
|
|
|
Environment="FPM_SOCKET_PATH=/run/php/php-fpm-%i.sock"
|
|
|
|
ExecStart=/usr/sbin/php-fpm{{ php_version.stdout }} --nodaemonize --fpm-config /etc/php/{{ php_version.stdout }}/fpm/pool.d/%i.cfg
|
|
|
|
ExecReload=/bin/kill -USR2 $MAINPID
|
|
|
|
KillMode=process
|
|
|
|
Restart=on-failure
|
|
|
|
RestartSec=30s
|
|
|
|
|
|
|
|
# Hardening
|
|
|
|
# https://github.com/php/php-src/blob/master/sapi/fpm/php-fpm.service.in
|
2023-02-25 20:32:51 +01:00
|
|
|
LockPersonality=true
|
|
|
|
NoNewPrivileges=true
|
2022-08-18 08:40:39 +02:00
|
|
|
PrivateDevices=true
|
|
|
|
PrivateTmp=true
|
|
|
|
ProtectClock=true
|
|
|
|
ProtectControlGroups=true
|
|
|
|
ProtectKernelModules=true
|
|
|
|
ProtectKernelTunables=true
|
2023-02-25 20:32:51 +01:00
|
|
|
ProtectSystem=strict
|
2022-08-18 08:40:39 +02:00
|
|
|
RestrictRealtime=true
|
|
|
|
RestrictAddressFamilies=AF_INET AF_INET6 AF_NETLINK AF_UNIX
|
|
|
|
RestrictNamespaces=true
|
2023-02-25 20:32:51 +01:00
|
|
|
SystemCallArchitectures=native
|
2022-08-18 08:40:39 +02:00
|
|
|
SystemCallErrorNumber=EPERM
|
2023-02-25 20:32:51 +01:00
|
|
|
SystemCallFilter=@system-service
|
|
|
|
|
|
|
|
ReadWritePaths=-/var/log/
|
|
|
|
ReadWritePaths=-{{ php_fpm_log_dir }}
|
|
|
|
ReadWritePaths=-/var/run/
|
|
|
|
ReadWritePaths=-/run/
|
|
|
|
InaccessiblePaths=-/root/
|
|
|
|
RuntimeDirectory=php
|
|
|
|
RuntimeDirectoryPreserve=yes
|
2022-08-18 08:40:39 +02:00
|
|
|
|
|
|
|
[Install]
|
|
|
|
WantedBy=multi-user.target
|