La configuration php de mon nginx (c'est un fichier que j'inclue dans les fichiers de description des sites.
> location ~ \.php$ {
> fastcgi_split_path_info ^(.+\.php)(/.+)$;
>
> fastcgi_pass unix:/var/run/php5-fpm.sock;
> fastcgi_index index.php;
> include fastcgi_params;
> }
Le contenus du fichier fastcgi_params :
> fastcgi_param QUERY_STRING $query_string;
> fastcgi_param REQUEST_METHOD $request_method;
> fastcgi_param CONTENT_TYPE $content_type;
> fastcgi_param CONTENT_LENGTH $content_length;
>
> fastcgi_param SCRIPT_NAME $fastcgi_script_name;
> fastcgi_param REQUEST_URI $request_uri;
> fastcgi_param DOCUMENT_URI $document_uri;
> fastcgi_param DOCUMENT_ROOT $document_root;
> fastcgi_param SERVER_PROTOCOL $server_protocol;
> fastcgi_param HTTPS $https if_not_empty;
>
> fastcgi_param GATEWAY_INTERFACE CGI/1.1;
> fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
>
> fastcgi_param REMOTE_ADDR $remote_addr;
> fastcgi_param REMOTE_PORT $remote_port;
> fastcgi_param SERVER_ADDR $server_addr;
> fastcgi_param SERVER_PORT $server_port;
> fastcgi_param SERVER_NAME $server_name;
>
> # PHP only, required if PHP was built with --enable-force-cgi-redirect
> fastcgi_param REDIRECT_STATUS 200;
> # grep -v '^;' /etc/php5/fpm/php-fpm.conf | grep '..' # pour virer les lignes inutiles (commentaires et lignes vides)
> [global]
> pid = /run/php5-fpm.pid
> error_log = /var/log/php5-fpm.log
> syslog.ident = php-fpm
> log_level = debug
> emergency_restart_threshold = 10
> emergency_restart_interval = 1m
> process_control_timeout = 10
> include=/etc/php5/fpm/pool.d/*.conf
Dans /etc/php5/fpm/pool.d/ je n'ai que le fichier :
> # grep -v '^;' /etc/php5/fpm/pool.d/
www.conf | grep '..'
> [www]
> user = www-data
> group = www-data
> listen = /var/run/php5-fpm.sock
> listen.owner = www-data
> listen.group = www-data
> pm = dynamic
> pm.max_children = 5
> pm.start_servers = 2
> pm.min_spare_servers = 1
> pm.max_spare_servers = 3
> chdir = /
> php_flag[display_errors] = off
> php_admin_value[error_log] = /var/log/fpm-php.
www.log> php_admin_flag[log_errors] = on
> php_admin_value[memory_limit] = 32M
Enfin le fichier php.init :
https://gist.github.com/barmic/2ba698313707090f780fEnfin le fichier de log de php-fpm et celui de l'un de mes sites :
> [08-May-2015 13:35:46] NOTICE: Finishing ...
> [08-May-2015 13:35:46] NOTICE: exiting, bye-bye!
> [08-May-2015 13:58:12] NOTICE: configuration file /etc/php5/fpm/php-fpm.conf test is successful
>
> [08-May-2015 13:58:12] NOTICE: fpm is running, pid 24017
> [08-May-2015 13:58:12] NOTICE: ready to handle connections
> [08-May-2015 13:58:12] NOTICE: systemd monitor interval set to 10000ms
> [08-May-2015 13:58:33] NOTICE: Finishing ...
> [08-May-2015 13:58:33] NOTICE: exiting, bye-bye!
> [08-May-2015 13:58:33] NOTICE: fpm is running, pid 26013
> [08-May-2015 13:58:33] NOTICE: ready to handle connections
> [08-May-2015 13:58:33] NOTICE: systemd monitor interval set to 10000ms
> [08-May-2015 13:58:34] NOTICE: configuration file /etc/php5/fpm/php-fpm.conf test is successful
================================================
> 127.0.0.1 - - [09/May/2015:14:35:41 +0200] "GET /doku.php HTTP/1.1" 200 31 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:36.0) Gecko/20100101 Firefox/36.0 Iceweasel/36.0.4"
> 127.0.0.1 - - [09/May/2015:14:36:35 +0200] "GET /doku.dlksjlk HTTP/1.1" 404 142 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:36.0) Gecko/20100101 Firefox/36.0 Iceweasel/36.0.4"
> 127.0.0.1 - - [09/May/2015:14:37:00 +0200] "GET /doku.php HTTP/1.1" 502 172 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:36.0) Gecko/20100101 Firefox/36.0 Iceweasel/36.0.4"
> 127.0.0.1 - - [09/May/2015:14:40:28 +0200] "GET /doku.php HTTP/1.1" 200 31 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:36.0) Gecko/20100101 Firefox/36.0 Iceweasel/36.0.4"
> 127.0.0.1 - - [09/May/2015:17:54:00 +0200] "GET /doku.php HTTP/1.1" 200 31 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:36.0) Gecko/20100101 Firefox/36.0 Iceweasel/36.0.4"
> 127.0.0.1 - - [09/May/2015:17:54:02 +0200] "GET /doku.php HTTP/1.1" 200 31 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:36.0) Gecko/20100101 Firefox/36.0 Iceweasel/36.0.4"
> 127.0.0.1 - - [09/May/2015:17:56:23 +0200] "GET /doku.php HTTP/1.1" 200 31 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:36.0) Gecko/20100101 Firefox/36.0 Iceweasel/36.0.4"
> 127.0.0.1 - - [09/May/2015:17:56:24 +0200] "GET /doku.php HTTP/1.1" 200 31 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:36.0) Gecko/20100101 Firefox/36.0 Iceweasel/36.0.4"
> 127.0.0.1 - - [09/May/2015:17:56:24 +0200] "GET /doku.php HTTP/1.1" 200 31 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:36.0) Gecko/20100101 Firefox/36.0 Iceweasel/36.0.4"
> 127.0.0.1 - - [09/May/2015:17:56:24 +0200] "GET /doku.php HTTP/1.1" 200 31 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:36.0) Gecko/20100101 Firefox/36.0 Iceweasel/36.0.4"
> 127.0.0.1 - - [09/May/2015:17:56:24 +0200] "GET /doku.php HTTP/1.1" 200 31 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:36.0) Gecko/20100101 Firefox/36.0 Iceweasel/36.0.4"
> 127.0.0.1 - - [09/May/2015:17:56:25 +0200] "GET /doku.php HTTP/1.1" 200 31 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:36.0) Gecko/20100101 Firefox/36.0 Iceweasel/36.0.4"
> 127.0.0.1 - - [09/May/2015:18:08:37 +0200] "GET /doku.php HTTP/1.1" 200 31 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:36.0) Gecko/20100101 Firefox/36.0 Iceweasel/36.0.4"
> 127.0.0.1 - - [09/May/2015:22:21:01 +0200] "GET /doku.php HTTP/1.1" 200 31 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:36.0) Gecko/20100101 Firefox/36.0 Iceweasel/36.0.4"
> 127.0.0.1 - - [09/May/2015:22:21:03 +0200] "GET /doku.php HTTP/1.1" 200 31 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:36.0) Gecko/20100101 Firefox/36.0 Iceweasel/36.0.4"
--
_____________________
Michel BARRET