summary refs log tree commit diff
path: root/nixos/modules/services/web-servers
diff options
context:
space:
mode:
authorPeter Hoeg <peter@speartail.com>2016-10-05 23:30:31 +0800
committerPeter Hoeg <peter@speartail.com>2016-10-05 23:30:31 +0800
commit5a6626f47c7bab0232b865a2ef7570b426c56412 (patch)
treee0fc8bc915a8f490440ee0eaf116999a2ab2f197 /nixos/modules/services/web-servers
parenta6de7142cea85a552fa10d99869e89d42c90c36f (diff)
downloadnixlib-5a6626f47c7bab0232b865a2ef7570b426c56412.tar
nixlib-5a6626f47c7bab0232b865a2ef7570b426c56412.tar.gz
nixlib-5a6626f47c7bab0232b865a2ef7570b426c56412.tar.bz2
nixlib-5a6626f47c7bab0232b865a2ef7570b426c56412.tar.lz
nixlib-5a6626f47c7bab0232b865a2ef7570b426c56412.tar.xz
nixlib-5a6626f47c7bab0232b865a2ef7570b426c56412.tar.zst
nixlib-5a6626f47c7bab0232b865a2ef7570b426c56412.zip
php fpm: add systemd support
PHP FPM will now notify systemd when it's done initializing and ready to
serve requests.

Additionally ```systemctl status phpfpm``` will now show statistics such
as:

```
Status: "Processes active: 0, idle: 8, Requests: 0, slow: 0, Traffic: 0req/sec"
```
Diffstat (limited to 'nixos/modules/services/web-servers')
-rw-r--r--nixos/modules/services/web-servers/phpfpm/default.nix9
1 files changed, 3 insertions, 6 deletions
diff --git a/nixos/modules/services/web-servers/phpfpm/default.nix b/nixos/modules/services/web-servers/phpfpm/default.nix
index a3a23b222fbb..787eed1c0ca4 100644
--- a/nixos/modules/services/web-servers/phpfpm/default.nix
+++ b/nixos/modules/services/web-servers/phpfpm/default.nix
@@ -7,8 +7,6 @@ let
 
   stateDir = "/run/phpfpm";
 
-  pidFile = "${stateDir}/phpfpm.pid";
-
   mkPool = n: p: ''
     [${n}]
     listen = ${p.listen}
@@ -17,9 +15,8 @@ let
 
   cfgFile = pkgs.writeText "phpfpm.conf" ''
     [global]
-    pid = ${pidFile}
     error_log = syslog
-    daemonize = yes
+    daemonize = no
     ${cfg.extraConfig}
 
     ${concatStringsSep "\n" (mapAttrsToList mkPool cfg.pools)}
@@ -43,7 +40,7 @@ in {
         description = ''
           Extra configuration that should be put in the global section of
           the PHP-FPM configuration file. Do not specify the options
-          <literal>pid</literal>, <literal>error_log</literal> or
+          <literal>error_log</literal> or
           <literal>daemonize</literal> here, since they are generated by
           NixOS.
         '';
@@ -129,8 +126,8 @@ in {
         mkdir -p "${stateDir}"
       '';
       serviceConfig = {
+        Type = "notify";
         ExecStart = "${cfg.phpPackage}/bin/php-fpm -y ${cfgFile} -c ${phpIni}";
-        PIDFile = pidFile;
       };
     };