No puedo hacer que los registros de errores de php-fpm aparezcan en docker std. Hasta ahora he intentado muchas sugerencias, pero por alguna razón no he progresado en absoluto. Estoy publicando toda mi configuración para que alguien pueda ayudarme amablemente en la dirección correcta. Todo lo que veo es app_php_1 | 172.21.0.7 - 06/Apr/2019:12:26:37 +0000 "GET /index.php" 500
PHP-FPM
Dockerfile
FROM php:7.2.13-fpm-alpine3.8RUN apk update \ && apk add --no-cache $PHPIZE_DEPS \ bash git zip unzipRUN docker-php-ext-install opcacheRUN docker-php-ext-enable opcacheRUN rm -rf /var/cache/apk/*COPY php.ini /usr/local/etc/php/conf.d/php.override.iniCOPY www.conf /usr/local/etc/php-fpm.d/www.confWORKDIR /appCMD ["php-fpm", "--nodaemonize"]
php.ini
[php]date.timezone=UTClog_errors=Onerror_reporting=E_ALL & ~E_DEPRECATED & ~E_STRICTdisplay_errors=Offmax_execution_time=60memory_limit=256M[opcache]opcache.enable_cli=1opcache.memory_consumption=256opcache.max_accelerated_files=20000realpath_cache_size=4096Krealpath_cache_ttl=600
www.conf
[global]daemonize=no[www]user=www-datagroup=www-datalisten=app_nginx:9000pm=dynamicpm.max_children=30pm.start_servers=2pm.min_spare_servers=2pm.max_requests=1000
NGINX
Dockerfile
FROM nginx:1.15.8-alpineRUN apk add --no-cache bashRUN rm -rf /var/cache/apk/*COPY app.conf /etc/nginx/conf.d/default.confCOPY nginx.conf /etc/nginx/nginx.confCOPY app_ssl.crt /etc/ssl/certs/app_ssl.crtCOPY app_ssl.key /etc/ssl/private/app_ssl.key
aplicación.conf
server { listen 80; server_name localhost; root /app/public; listen 443 default_server ssl; ssl_certificate /etc/ssl/certs/app_ssl.crt; ssl_certificate_key /etc/ssl/private/app_ssl.key; location / { try_files $uri /index.php$is_args$args; } location ~ ^/index\.php(/|$) { fastcgi_pass app_php:9000; fastcgi_split_path_info ^(.+\.php)(/.*)$; fastcgi_hide_header X-Powered-By; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; fastcgi_param DOCUMENT_ROOT $realpath_root; internal; } location ~ \.php$ { return 404; }}
nginx.conf
user nginx;worker_processes 2;error_log /var/log/nginx/error.log warn;pid /var/run/nginx.pid;events { worker_connections 1024; use epoll;}http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format json_combined escape=json '{' '"time_local":"$time_local",' '"remote_addr":"$remote_addr",' '"remote_user":"$remote_user",' '"request":"$request",' '"status": "$status",' '"body_bytes_sent":"$body_bytes_sent",' '"request_time":"$request_time",' '"http_referrer":"$http_referer",' '"http_user_agent":"$http_user_agent"' '}'; access_log /var/log/nginx/access.log json_combined; fastcgi_buffers 8 16k; fastcgi_buffer_size 32k; fastcgi_connect_timeout 300; fastcgi_send_timeout 300; fastcgi_read_timeout 300; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; server_tokens off; add_header X-Content-Type-Options nosniff; add_header X-XSS-Protection '1; mode=block'; add_header X-Frame-Options DENY; add_header Strict-Transport-Security 'max-age=31536000; includeSubdomains; preload'; add_header 'Referrer-Policy' 'no-referrer-when-downgrade'; types_hash_max_size 2048; gzip on; include /etc/nginx/conf.d/*.conf;}
docker-compose.yml
version: "3"services: app_php: build: context: "./php" volumes: - "../..:/app:consistent" app_nginx: build: context: "./nginx" ports: - "5080:80" - "5443:443" volumes: - "../..:/app:consistent" depends_on: - "aapp_php"
LO QUE INTENTÉ
Los probé de forma independiente el uno del otro / archivo, no todos de una vez.
Cambiar
/proc/self/fd/2
a/dev/stdout
//dev/stderr
paraerror_log
yaccess.log
propiedades en/usr/local/etc/php-fpm.d/docker.conf
file.Código agregado a continuación en la parte inferior de
www.conf
file.
catch_workers_output = yesphp_flag[display_errors] = offphp_admin_flag[log_errors] = onphp_admin_value[error_log] = /var/log/php-fpm-error.logphp_admin_value[error_log] = /dev/stdoutphp_admin_value[error_log] = /dev/stderr
- Un poco más, pero lo perdí de vista.