init
This commit is contained in:
parent
7d25765eea
commit
3a1975b986
60
HowtoPHPFPM.md
Normal file
60
HowtoPHPFPM.md
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
# Howto PHP-FPM
|
||||||
|
|
||||||
|
PHP-FPM (FastCGI Process Manager) est une façon alternative d'utiliser PHP avec [Apache](HowtoApache) ou [Nginx](HowtoNginx).
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
~~~
|
||||||
|
# apt install php5-fpm
|
||||||
|
~~~
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
<http://php.net/manual/fr/install.fpm.configuration.php>
|
||||||
|
|
||||||
|
La configuration de PHP-FPM se trouve dans `/etc/php5/fpm/php-fpm.conf`.
|
||||||
|
|
||||||
|
Voici les directives de base :
|
||||||
|
|
||||||
|
~~~
|
||||||
|
[global]
|
||||||
|
pid = /run/php5-fpm.pid
|
||||||
|
error_log = /var/log/php5-fpm.log
|
||||||
|
~~~
|
||||||
|
|
||||||
|
On définit ensuite un ou plusieurs "pools" FPM via /etc/php5/fpm/pool.d/*.conf :
|
||||||
|
|
||||||
|
~~~
|
||||||
|
[www]
|
||||||
|
listen = /var/run/php5-fpm.sock
|
||||||
|
;listen = 127.0.0.1:9000
|
||||||
|
user = www-data
|
||||||
|
group = www-data
|
||||||
|
pm = dynamic
|
||||||
|
pm.max_children = 50
|
||||||
|
pm.start_servers = 20
|
||||||
|
pm.min_spare_servers = 5
|
||||||
|
pm.max_spare_servers = 35
|
||||||
|
pm.max_requests = 0
|
||||||
|
~~~
|
||||||
|
|
||||||
|
## Configuration avec Nginx :
|
||||||
|
|
||||||
|
On configure maintenant Nginx, par exemple dans un Virtualhost foo :
|
||||||
|
|
||||||
|
~~~
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name www.example.com example.com;
|
||||||
|
root /home/foo/www;
|
||||||
|
index index.html index.php;
|
||||||
|
|
||||||
|
location ~ \.php$ {
|
||||||
|
try_files $uri =404;
|
||||||
|
#fastcgi_pass 127.0.0.1:9000;
|
||||||
|
fastcgi_pass unix:/var/run/php5-fpm.sock;
|
||||||
|
fastcgi_param SCRIPT_FILENAME /home/foo/www$fastcgi_script_name;
|
||||||
|
include fastcgi_params;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
~~~
|
Loading…
Reference in a new issue