Phpfpm: Difference between revisions
Appearance
imported>Makefu No edit summary |
imported>Makefu add outdated tag |
||
Line 1: | Line 1: | ||
php-fpm is a fastcgi interface for php. | php-fpm is a fastcgi interface for php. | ||
{{outdated|phpfpm has a more granuar configuration via [https://nixos.org/nixos/options.html#phpfpm.pools services.phpfpm.pools]}} | |||
== Configuration for nginx== | == Configuration for nginx== | ||
This configuration will set up phpfpm for serving php files from <code>/var/www/example.com</code>. | This configuration will set up phpfpm for serving php files from <code>/var/www/example.com</code>. |
Revision as of 10:35, 15 October 2019
php-fpm is a fastcgi interface for php.
⏲︎︎
This article or section is outdated. phpfpm has a more granuar configuration via services.phpfpm.pools Further information might be found in the corresponding discussion. Please remove this notice once the information has been updated.
Configuration for nginx
This configuration will set up phpfpm for serving php files from /var/www/example.com
.
put into your configuration.nix
{
services.phpfpm.poolConfigs."example.com" = ''
listen = /var/run/example.com-phpfpm.sock
user = nginx
group = nginx
pm = dynamic
pm.max_children = 32
pm.max_requests = 500
pm.start_servers = 2
pm.min_spare_servers = 2
pm.max_spare_servers = 5
listen.owner = nginx
listen.group = nginx
php_admin_value[error_log] = 'stderr'
php_admin_flag[log_errors] = on
env[PATH] = ${lib.makeBinPath [ pkgs.php ]}
catch_workers_output = yes
'';
services.nginx = {
enable = true;
virtualHosts."example.com".locations."/" = {
root = "/var/www/example.com";
extraConfig = ''
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/example.com-phpfpm.sock;
include ${pkgs.nginx}/conf/fastcgi_params;
include ${pkgs.nginx}/conf/fastcgi.conf;
'';
};
};
};
}
PHP Extensions
To use certain PHP extensions you will need to configure them in the php.ini
-configuration of phpfpm:
{
services.phpfpm.phpOptions = ''
extension=${pkgs.phpPackages.redis}/lib/php/extensions/redis.so
extension=${pkgs.phpPackages.apcu}/lib/php/extensions/apcu.so
'';
}