Phpfpm: Difference between revisions
imported>Florianjacob m correct surrounding text |
m link added, Category:PHP added |
||
(4 intermediate revisions by 4 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.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 56: | Line 65: | ||
{ | { | ||
services.phpfpm.phpOptions = '' | services.phpfpm.phpOptions = '' | ||
extension=${pkgs. | extension=${pkgs.phpExtensions.redis}/lib/php/extensions/redis.so | ||
extension=${pkgs. | extension=${pkgs.phpExtensions.apcu}/lib/php/extensions/apcu.so | ||
''; | ''; | ||
} | } | ||
</syntaxHighlight> | </syntaxHighlight> | ||
[[Category:PHP]] |