Up to now I have used LAMP only in the different linux distros. Nginx is
new for me.
With the help of NixOS wiki I have edited configuration.nix, and after
nixos-rebuild switch
ran info.php . Browser displayed PHP 8.2.18 page.
But after reboot nginx reported error
An error occurred during a connection to localhost
when trying info.php. I had rebuild nixos and php worked again. And such is every time when I reboot NixOS.
I find that after reboot
[root@nixos:/]# ps -ax | grep php
3342 pts/0 S+ 0:00 grep php
Only one php process exists. After nixos-rebuild switch
[root@nixos:/]# ps -ax | grep php 9114 ? Ss 0:00 php-fpm: master process (/nix/store/4mvv1v52vif941p76mq3d7gd8qmi9l1d-phpfpm-mypool.conf) 9212 ? S 0:00 php-fpm: pool mypool 9213 ? S 0:00 php-fpm: pool mypool 9371 pts/0 S+ 0:00 grep php
Have I omitted something ?
This is relevant part of the configuration.nix file
services.nginx.enable = true; services.nginx.package = pkgs.nginxStable.override { openssl = pkgs.libressl; }; services.nginx.virtualHosts.“localhost” = { addSSL = true; enableACME = true; root = “/data/www/”; locations.“~ \.php$”.extraConfig = ‘’ fastcgi_pass unix:${config.services.phpfpm.pools.mypool.socket}; fastcgi_index index.php; ‘’; }; security.acme = { acceptTerms = true; defaults.email = “postmaster@vcelarim.sk”; }; services.mysql = { enable = true; package = pkgs.mariadb; }; services.phpfpm.pools.mypool = { user = “nobody”; settings = { “pm” = “dynamic”; “listen.owner” = config.services.nginx.user; “pm.max_children” = 5; “pm.start_servers” = 2; “pm.min_spare_servers” = 1; “pm.max_spare_servers” = 3; “pm.max_requests” = 500; }; };