Phpfpm: Difference between revisions
imported>Makefu Created page with "php-fpm is a fastcgi interface for php. == Configuration for nginx== This configuration will set up phpfpm for serving php files from <code>/var/www/example.com</code>. put i..." |
imported>Makefu No edit summary |
||
| Line 4: | Line 4: | ||
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>. | ||
put into your <code>configuration.nix</code> | put into your <code>configuration.nix</code> | ||
<syntaxHighlight lang=nix> | <syntaxHighlight lang=nix> | ||
{ | { | ||
services.phpfpm.poolConfigs."example.com" = '' | |||
listen = /var/run/example.com-phpfpm.sock | listen = /var/run/example.com-phpfpm.sock | ||
user = nginx | user = nginx | ||
| Line 22: | Line 23: | ||
env[PATH] = ${lib.makeBinPath [ pkgs.php ]} | env[PATH] = ${lib.makeBinPath [ pkgs.php ]} | ||
catch_workers_output = yes | 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; | |||
''; | |||
}; | }; | ||
}; | |||
}; | |||
} | } | ||
</ | </syntaxHighlight> | ||
== PHP Extensions == | == PHP Extensions == | ||
To use certain PHP extensions you will need to configure them in the <code>php.ini</code>-configuration of phpfpm: | To use certain PHP extensions you will need to configure them in the <code>php.ini</code>-configuration of phpfpm: | ||
< | <syntaxHighlight lang=nix> | ||
{ | { | ||
services.phpfpm.phpOptions = '' | services.phpfpm.phpOptions = '' | ||
| Line 49: | Line 50: | ||
''; | ''; | ||
} | } | ||
</ | </syntaxHighlight> | ||