Phpfpm: Difference between revisions

imported>Sikmir
No edit summary
Klinger (talk | contribs)
m link added, Category:PHP added
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
php-fpm is a fastcgi interface for php.
[https://www.php.net/manual/en/install.fpm.php php-fpm] is a fastcgi interface for php.


== Configuration for nginx==
== Configuration for nginx==
Line 35: Line 35:
         fastcgi_split_path_info ^(.+\.php)(/.+)$;
         fastcgi_split_path_info ^(.+\.php)(/.+)$;
         fastcgi_pass unix:${config.services.phpfpm.pools.${app}.socket};
         fastcgi_pass unix:${config.services.phpfpm.pools.${app}.socket};
        include ${pkgs.nginx}/conf/fastcgi_params;
         include ${pkgs.nginx}/conf/fastcgi.conf;
         include ${pkgs.nginx}/conf/fastcgi.conf;
       '';
       '';
Line 49: Line 48:
}
}
</syntaxHighlight>
</syntaxHighlight>
===  Escaping special chars ===
When using regular expressions in <code>locations</code> blocks, be ware of the [https://nixos.org/manual/nix/stable/language/values.html#type-string need to escape some special chars] like <code>\</code>.
i.e. <code>locations."~ ^(.+\.php)(.*)$"  = {</code> should be escaped to <code>locations."~ ^(.+\\.php)(.*)$"  = {</code>
Otherwise file names like ''gly'''php'''ro.css'' will be matched and parsed by the php interpreter. Which likely fails with an access error because of php-fpms [https://www.php.net/manual/en/install.fpm.configuration.php security.limit_extensions].
See also [[Nginx | the nginx article]].


== PHP Extensions ==
== PHP Extensions ==
Line 61: Line 70:
}
}
</syntaxHighlight>
</syntaxHighlight>
[[Category:PHP]]