J'ai deux conteneurs docker pour php-fpm et nginx, je les exécute avec le fichier docker-compose.yml, mais j'essaie de configurer la page d'état de mon php-fpm et elle n'est pas trouvée.
j'ai accès à http://localhost/status url et il montre le message File not found.
J'ai essayé plusieurs configurations mais ça ne marche pas.
C'est mon arbre directif :
C:.
docker-compose.yml
app
index.php
fpmConf
www.conf
nginxConf
default.conf
phpConf
php.ini
mon fichier docker-compose.yml est :
version: '3'
services:
php:
image: php:7.2-fpm
container_name: php_app
restart: always
environment:
TZ: America/Mexico_City
ports:
- 9000:9000
volumes:
- ./app:/var/www/html
- ./phpConf/php.ini:/usr/local/etc/php/conf.d/custom.ini
tty: true
nginx:
image: nginx:latest
container_name: nginx_proxy
restart: always
environment:
TZ: America/Mexico_City
ports:
- 80:80
links:
- php
volumes:
- ./app:/var/www/html
- ./nginxConf:/etc/nginx/conf.d
- ./fpmConf/www.conf:/etc/php-fpm.d/www.conf
depends_on:
- php
tty: true
mon fichier www.conf est :
user = www
listen = php:9000
pm = ondemand
pm.max_children = 50
pm.max_requests = 500
pm.process_idle_timeout = 10s
pm.status_path = /status
ping.path = /ping
slowlog = /data/logs/php-fpm-slow.log
request_slowlog_timeout = 60
catch_workers_output = yes
env[TMPDIR] = /data/tmp/php
include = /data/conf/php-fpm-www-*.conf
mon fichier default.conf est :
upstream php-upstream {
server php:9000;
}
server {
server_tokens off;
charset utf-8;
client_max_body_size 128M;
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
listen 80;
server_name localhost;
# set caching header for static files
location ~* \.(jpg|jpeg|gif|png|css|js|ico|svg|ttf|webp)$ {
access_log off;
log_not_found off;
expires 30d;
}
root /var/www/html;
index index.php;
location / {
try_files $uri $uri/ /index.php$is_args$args;
location ~ \.php$ {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_pass php:9000;
fastcgi_index index.php;
fastcgi_pass_header Set-Cookie;
fastcgi_pass_header Cookie;
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
}
}
location /status {
access_log off;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass php-upstream;
fastcgi_index status.html;
}
}
mon fichier php.ini est :
date.timezone = "America/Mexico_City"
default_charset = "utf-8";
mbstring.internal_encoding=utf-8;
mbstring.http_output=UTF-8;
mbstring.encoding_translation=On;
session.use_cookies = 1
session.name = PHPSESSID
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain = alocalhost
session.serialize_handler = php
session.gc_maxlifetime = 86400
max_input_vars = 1000000