Giter Site home page Giter Site logo

docker-nginx-php-fpm's Introduction

github.com/tiredofit/docker-nginx-php-fpm

GitHub release Build Status Docker Stars Docker Pulls Become a sponsor Paypal Donate


About

This repository will build a Nginx w/PHP-FPM docker image, suitable for serving PHP scripts, or utilizing as a base image for installing additional software.

  • Tracking PHP 5.3-8.3
  • Easily enable / disable extensions based on your use case
  • Automatic Log rotation
  • Composer Included
  • XDebug capability
  • Caching via APC, opcache
  • Includes client libraries for MariaDB and Postgresql

Maintainer

Table of Contents

Prerequisites and Assumptions

  • Assumes you are using some sort of SSL terminating reverse proxy such as:

Installation

Build from Source

Clone this repository and build the image with docker build -t (imagename) .

Prebuilt Images

Builds of the image are available on Docker Hub

docker pull docker.io/tiredofit/nginx-php-fpm:(imagetag)

Builds of the image are also available on the Github Container Registry

docker pull ghcr.io/tiredofit/docker-nginx-php-fpm:(imagetag)

The following image tags are available along with their tagged release based on what's written in the Changelog:

PHP version Alpine Base Tag Debian Base Tag
latest edge :alpine-edge
8.3.x 3.20 :8.3-alpine Bookworm :8.3-debian-bookworm
8.2.x 3.20 :8.2-alpine Bookworm :8.2-debian-bookworm
8.1.x 3.19 :8.1-alpine Bookworm :8.1-debian-bookworm
8.0.x 3.16 :8.0-alpine Bookworm :8.0-debian-bookworm
7.4.x 3.15 :7.4-alpine Bookworm :7.4-debian-bookworm
7.3.x 3.12 :7.3-alpine Bookworm :7.3-debian-bookworm
7.2.x 3.9 :7.2-alpine
7.1.x 3.7 :7.1-alpine
7.0.x 3.5 :7.0-alpine
5.6.x 3.8 :5.6-alpine
5.5.x 3.4 :5.5-latest
5.3.x 3.4 :5.3-latest

Multi Architecture

Images are built primarily for amd64 architecture, and may also include builds for arm/v7, arm64 and others. These variants are all unsupported. Consider sponsoring my work so that I can work with various hardware. To see if this image supports multiple architecures, type docker manifest (image):(tag)

Configuration

Quick Start

  • The quickest way to get started is using docker-compose. See the examples folder for a working compose.yml that can be modified for development or production use.

  • Set various environment variables to understand the capabilities of this image.

  • Map persistent storage for access to configuration and data files for backup.

The container starts up and reads from /etc/nginx/nginx.conf for some basic configuration and to listen on port 73 internally for Nginx Status responses. Configuration of websites are done in /etc/services.available with the filename pattern of site.conf. You must set an environment variable for NGINX_SITE_ENABLED if you have more than one configuration in there if you only want to enable one of the configurartions, otherwise it will enable all of them. Use NGINX_SITE_ENABLED=null to break a parent image declaration.

Use this as a starting point for your site configurations:

  server {
      ### Don't Touch This
      listen {{NGINX_LISTEN_PORT}};
      server_name localhost;
      root {{NGINX_WEBROOT}};

      ### Populate your custom directives here
      index  index.php index.html index.htm;

      # Deny access to any files with a .php extension in the uploads directory
      location ~* /(?:uploads|files)/.*\.php$ {
          deny all;
      }

      location / {
          try_files \$uri \$uri/ /index.php?\$args;
      }

      ### Populate your custom directives here
      location ~ \.php(/|\$) {
          include /etc/nginx/snippets/php-fpm.conf;
          fastcgi_split_path_info ^(.+?\.php)(/.+)\$;
          fastcgi_param PATH_INFO \$fastcgi_path_info;
          fastcgi_index index.php;
          include fastcgi_params;
          fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
      }

      ### Don't edit past here
      include /etc/nginx/snippets/site_optimization.conf;
      include /etc/nginx/snippets/exploit_protection.conf;
    }

Persistent Storage

The container starts up and reads from /etc/nginx/nginx.conf for some basic configuration and to listen on port 73 internally for Nginx Status responses. /etc/nginx/conf.d contains a sample configuration file that can be used to customize a nginx server block.

The following directories are used for configuration and can be mapped for persistent storage.

Directory Description
/www/html Root Directory
/www/logs Nginx and php-fpm logfiles

Environment Variables

Base Images used

This image relies on an Alpine Linux or Debian Linux base image that relies on an init system for added capabilities. Outgoing SMTP capabilities are handlded via msmtp. Individual container performance monitoring is performed by zabbix-agent. Additional tools include: bash,curl,less,logrotate, nano. Be sure to view the following repositories to understand all the customizable options:

Image Description
OS Base Customized Image based on Alpine Linux
Nginx Nginx webserver

Container Options

The container has an ability to work in 3 modes, nginx-php-fpm (default) is an All in One image with nginx and php-fpm working together, nginx will only utilize nginx however not the included php-fpm instance, allowing for connecting to multiple remote php-fpm backends, and finally php-fpm to operate PHP-FPM in standalone mode.

Parameter Description Default
PHP_FPM_CONTAINER_MODE Mode of running container nginx-php-fpm, nginx, php-fpm nginx-php-fpm

When PHP_FPM_CONTAINER_MODE set to nginx the PHP_FPM_LISTEN_PORT environment variable is ignored and the PHP_FPM_HOST variable defined below changes. You can add multiple PHP-FPM hosts to the backend in this syntax : seperated by commas e.g php-fpm-container1:9000,php-fpm-container2:9000

You can also pass arguments to each server as defined in the Nginx Upstream Documentation

Parameter Description Default
PHP_APC_SHM_SIZE APC Cache Memory size - 0 to disable 128M
PHP_APC_TTL APC Time to live in seconds 7200
PHP_FPM_HOST PHP-FPM Host, dependenent on PHP_FPM_LISTEN_TYPE, add multiple with commas 127.0.0.1:9000 or /var/run/php-fpm.sock
PHP_FPM_LISTEN_TYPE PHP-FPM listen type UNIX sockets or TCP sockets unix
PHP_FPM_LISTEN_TCP_IP PHP-FPM Listening IP if PHP_LISTEN_TYPE=TCP 0.0.0.0
PHP_FPM_LISTEN_TCP_IP_ALLOWED PHP-FPM allow only these hosts if PHP_LISTEN_TYPE=TCP 127.0.0.1
PHP_FPM_LISTEN_TCP_PORT PHP-FPM Listening Port - Ignored with above container options 9000
PHP_FPM_LISTEN_UNIX_SOCKET PHP-FPM Listen Socket if PHP_LISTEN_TYPE=UNIX /var/run/php-fpm.sock
PHP_FPM_LISTEN_UNIX_SOCKET_USER PHP-FPM Listen Socket user PHP_LISTEN_TYPE=UNIX ${NGINX_USER} or ${UNIT_USER}
PHP_FPM_LISTEN_UNIX_SOCKET_GROUP PHP-FPM Listen Socket group PHP_LISTEN_TYPE=UNIX ${NGINX_GROUP} or ${UNIT_GROUP}
PHP_FPM_MAX_CHILDREN Maximum Children 75
PHP_FPM_MAX_REQUESTS How many requests before spawning new server 500
PHP_FPM_MAX_SPARE_SERVERS Maximum Spare Servers available 3
PHP_FPM_MIN_SPARE_SERVERS Minium Spare Servers avaialble 1
PHP_FPM_OUTPUT_BUFFER_SIZE Output buffer size in bytes 0
PHP_FPM_POST_INIT_COMMAND If you wish to execute a command before php-fpm executes, enter it here and seperate multiples by comma.
PHP_FPM_POST_INIT_SCRIPT If you wish to execute a script before php-fpm executes, enter it here and seperate multiples by comma.
PHP_FPM_PROCESS_MANAGER How to handle processes static, ondemand, dynamic dynamic
PHP_FPM_START_SERVERS How many FPM servers to start initially 2
PHP_FPM_USER User to run PHP-FPM master process as ${NGINX_USER} or ${UNIT_USER}
PHP_HIDE_X_POWERED_BY Hide X-Powered by response TRUE
PHP_LOG_ACCESS_FILE PHP Access Logfile Name access.log
PHP_LOG_ERROR_FILE Logfile name error.log
PHP_LOG_LEVEL PHP Log Level alert error warning notice debug notice
PHP_LOG_ACCESS_FORMAT Log format - default or json default
PHP_LOG_LIMIT Characters to log 2048
PHP_LOG_LOCATION Log Location for PHP Logs /www/logs/php-fpm
PHP_MEMORY_LIMIT How much memory should PHP use 128M
PHP_OPCACHE_INTERNED_STRINGS_BUFFER OPCache interned strings buffer 8
PHP_OPCACHE_JIT_BUFFER_SIZE JIT Buffer Size 0 to disable 50M
PHP_OPCACHE_JIT_MODE JIT CRTO Mode - > PHP 8.x 1255
PHP_OPCACHE_MAX_ACCELERATED_FILES OPCache Max accelerated files 10000
PHP_OPCACHE_MEM_SIZE OPCache Memory Size - Set 0 to disable or via other env vars 128
PHP_OPCACHE_REVALIDATE_FREQ OPCache revalidate frequency in seconds 2
PHP_OPCACHE_MAX_WASTED_PERCENTAGE Max wasted percentage cache 5
PHP_OPCACHE_VALIDATE_TIMESTAMPS Validate timestamps 1 or 0 1
PHP_OPCACHE_SAVE_COMMENTS Opcache Save Comments 0 or 1 1
PHP_OPCACHE_MAX_FILE_SIZE Opcache maximum file size 0
PHP_OPCACHE_OPTIMIZATION_LEVEL Opcache optimization level 0x7FFFBFF
PHP_POST_MAX_SIZE Maximum Input Size for POST 2G
PHP_TIMEOUT Maximum Script execution Time 180
PHP_UPLOAD_MAX_SIZE Maximum Input Size for Uploads 2G
PHP_WEBROOT Used with CONTAINER_MODE=php-fpm /www/html

Enabling / Disabling Specific Extensions

Enable extensions by using the PHP extension name ie redis as PHP_ENABLE_REDIS=TRUE. Core extensions are enabled by default are:

Parameter Default
PHP_ENABLE_APCU TRUE
PHP_ENABLE_BCMATH TRUE
PHP_ENABLE_BZ2 TRUE
PHP_ENABLE_CTYPE TRUE
PHP_ENABLE_CURL TRUE
PHP_ENABLE_DOM TRUE
PHP_ENABLE_EXIF TRUE
PHP_ENABLE_FILEINFO TRUE
PHP_ENABLE_GD TRUE
PHP_ENABLE_ICONV TRUE
PHP_ENABLE_IMAP TRUE
PHP_ENABLE_INTL TRUE
PHP_ENABLE_JSON TRUE
PHP_ENABLE_MBSTRING TRUE
PHP_ENABLE_MYSQLI TRUE
PHP_ENABLE_MYSQLND TRUE
PHP_ENABLE_OPCACHE TRUE
PHP_ENABLE_OPENSSL TRUE
PHP_ENABLE_PDO TRUE
PHP_ENABLE_PDO_MYSQL TRUE
PHP_ENABLE_PGSQL TRUE
PHP_ENABLE_PHAR TRUE
PHP_ENABLE_SESSION TRUE
PHP_ENABLE_SIMPLEXML TRUE
PHP_ENABLE_TOKENIZER TRUE
PHP_ENABLE_XML TRUE
PHP_ENABLE_XMLREADER TRUE
PHP_ENABLE_XMLWRITER TRUE

To enable all extensions in image use PHP_KITCHENSINK=TRUE. Head inside the image and see what extensions are available by typing php-ext list all

Debug Options

To enable XDebug set PHP_ENABLE_XDEBUG=TRUE. Visit the PHP XDebug Documentation to understand what these options mean. If you debug a PHP project in PHPStorm, you need to set server name using PHP_IDE_CONFIG to the same value as set in PHPStorm. Usual value is localhost, i.e. PHP_IDE_CONFIG="serverName=localhost".

For Xdebug 2 (php <= 7.1) you should set:

Parameter Description Default
PHP_XDEBUG_PROFILER_DIR Where to store Profiler Logs /www/logs/xdebug/
PHP_XDEBUG_PROFILER_ENABLE Enable Profiler 0
PHP_XDEBUG_PROFILER_ENABLE_TRIGGER Enable Profiler Trigger 0
PHP_XDEBUG_REMOTE_AUTOSTART Enable Autostarting as opposed to GET/POST 1
PHP_XDEBUG_REMOTE_CONNECT_BACK Enbable Connection Back 0
PHP_XDEBUG_REMOTE_ENABLE Enable Remote Debugging 1
PHP_XDEBUG_REMOTE_HANDLER XDebug Remote Handler dbgp
PHP_XDEBUG_REMOTE_HOST Set this to your IP Address 127.0.0.1
PHP_XDEBUG_REMOTE_PORT XDebug Remote Port 9090

For Xdebug 3 (php >= 7.2) you should set:

Parameter Description Default
PHP_XDEBUG_OUTPUT_DIR Where to store Logs /www/logs/xdebug/
PHP_XDEBUG_MODE This setting controls which Xdebug features are enabled. develop
PHP_XDEBUG_START_WITH_REQUEST Enable Autostarting as opposed to GET/POST default
PHP_XDEBUG_DISCOVER_CLIENT_HOST Xdebug will try to connect to the client that made the HTTP request. 1
PHP_XDEBUG_CLIENT_HOST Set this to your IP Address 127.0.0.1
PHP_XDEBUG_CLIENT_PORT XDebug Remote Port 9003

Networking

The following ports are exposed.

Port Description
9000 PHP-FPM

Maintenance

Inside the image are tools to perform modification on how the image runs.

Shell Access

For debugging and maintenance purposes you may want access the containers shell.

docker exec -it (whatever your container name is e.g. nginx-php-fpm) bash

PHP Extensions

If you want to enable or disable or list what PHP extensions are available, type php-ext help

Maintenance Mode

If you wish to turn the web server into maintenance mode showing a single page screen outlining that the service is being worked on, you can also enter into the container and type maintenance ARG, where ARG is either ON,OFF, or SLEEP (seconds) which will temporarily place the site in maintenance mode and then restore it back to normal after time has passed.

Contributions

Welcomed. Please fork the repository and submit a pull request for any bug fixes, features or additions you propose to be included in the image. If it does not impact my intended usage case, it will be merged into the tree, tagged as a release and credit to the contributor in the CHANGELOG.

Support

These images were built to serve a specific need in a production environment and gradually have had more functionality added based on requests from the community.

Usage

  • The Discussions board is a great place for working with the community on tips and tricks of using this image.
  • Sponsor me for personalized support

Bugfixes

  • Please, submit a Bug Report if something isn't working as expected. I'll do my best to issue a fix in short order.

Feature Requests

  • Feel free to submit a feature request, however there is no guarantee that it will be added, or at what timeline.
  • Sponsor me regarding development of features.

Updates

  • Best effort to track upstream changes, More priority if I am actively using the image in a production environment.
  • Sponsor me for up to date releases.

License

MIT. See LICENSE for more details.

References

docker-nginx-php-fpm's People

Contributors

albertborsos avatar dependabot[bot] avatar fermion2020 avatar pleskan avatar radarsymphony avatar timoschwarzer avatar tiredofit avatar tomasvts avatar unlink avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-nginx-php-fpm's Issues

php-fpm doesn't start in PHP_FPM_CONTAINER_MODE=php-fpm

Summary

php-fpm doesn't start in PHP_FPM_CONTAINER_MODE=php-fpm

Steps to reproduce

# minimal reproducer
docker run -d --name php-fpm-test -e PHP_FPM_CONTAINER_MODE=php-fpm tiredofit/nginx-php-fpm:8.3-alpine

# what I was actually trying to do
docker run -d --name fusiondirectory -e PHP_FPM_CONTAINER_MODE=php-fpm -e PHP_FPM_LISTEN_TYPE=tcp --env-file ldapopts tiredofit/fusiondirectory:1.4

What is the expected correct behavior?

At least 1 php-fpm process is active in the contianer that is accessible over a Unix or TCP socket as configured.

Relevant logs and/or screenshots

Environment

  • Image version / tag: tiredofit/nginx-php-fpm:7.4-alpine tiredofit/nginx-php-fpm:8.3-alpine tiredofit/nginx-php-fpm:8.3-bookworm tiredofit/fusiondirectory:1.4 tiredofit/fusiondirectory:1.4 rebuilt from git
  • Host OS: Debian GNU/Linux 12.2 bookworm Linux 6.1.0-13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.55-1 (2023-09-29) x86_64 GNU/Linux

Possible fixes

This doesn't seem good but -e DONOTSTART=FALSE didn't help either (of course lol)

+ echo 'DONOTSTART added by 20-php-fpm"'
+ DONOTSTART=TRUE

Install Openswoole

Hi, I'd like to install openswoole with an own Dockerfile, but i couldn't it to enable.

My Dockerfile

FROM tiredofit/nginx-php-fpm:debian-8.2

# additional ENV vars
ENV NODE_VERSION=20.5.1
ENV NVM_DIR=/root/.nvm

# Install NVM for node
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
RUN . "$NVM_DIR/nvm.sh" \
    && nvm install ${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" \
    && nvm use v${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" \
    && nvm alias default v${NODE_VERSION}
ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}"

# Install ffmpeg, npm and yarn
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list

RUN apt update \
    && apt install vim ffmpeg nodejs yarn g++ make -y

RUN ln -s /bin/sed /usr/bin/sed

RUN php-ext enable sockets \
    && php-ext enable redis \
    #&& php-ext enable calendar \
    && php-ext enable zip \
    && pecl channel-update pecl.php.net \
    && pecl install --configureoptions 'enable-http2="yes" enable-openssl="yes"' openswoole-4.12.0 \
    && php-ext enable openswoole

#RUN echo 'extension=openswoole' >> $(php -i | grep /.+/php.ini -oE)
COPY php/openswoole.ini /etc/php/8.2/mods-available/openswoole.ini

The file openswoole.ini:

[Openswoole]
extension=openswoole

But if I'm build und start it, openswoole are not available. How can i enable it or is it possible to add it on your image?

Thanks for your great work ;-)

PHP Warning: fopen(): failed to open stream: "Quota exceeded"

Hi Dave,

I'm having a very strange error with some wordpress sites I'm running using your wordpress image, but I think if there's an issue it lies on php-fpm, so if I'm wrong my apologies and I will move this to the wordpress image.

On some sites I'm getting the following error:

NOTICE: PHP message: PHP Warning: fopen(/www/wordpress/wp-content/languages/plugins/wordpress-seo-es_ES.mo): failed to open stream: "Quota exceeded" in /www/wordpress/wp-includes/pomo/streams.php on line 148

Because of it nginx sometimes fails with a 502 bad gateway error. It happens with many files, not just that one from the quoted error.

I cannot find anything on this, all I can find is about "Disk quota exceeded", but this is just "Quota exceeded". The error only happens with this image, I have other php sites running on the same nodes that use another php+apache (no php-fpm) image and the error is not present.

Could it be php-fpm parameters ? this is my config that is shared among containers:

FPM_MAX_CHILDREN=120
FPM_MAX_REQUESTS=1000
PHP_MEMORY_LIMIT=512M

Those are low traffic sites if that's important. This is the first time that I bump into this error. Any hints would be greatly appreciated.

[BUG] nginx: [emerg] invalid port in upstream ":" in /etc/nginx/nginx.conf.d/php-fpm.conf:1

While testing https://github.com/tiredofit/docker-self-service-password, I got this error in logs nginx: [emerg] invalid port in upstream ":" in /etc/nginx/nginx.conf.d/php-fpm.conf:1 and the following file content:

fastcgi_pass :;
fastcgi_read_timeout ;

This generates code seems to be the issue:

fastcgi_pass <PHP_HOST>:<PHP_LISTEN_PORT>;
fastcgi_read_timeout <PHP_TIMEOUT>;

I believe the variables used should be PHP_FPM_HOST and PHP_FPM_LISTEN_PORT.

PHP does not read environment variables

PHP does not read environment variables

using docker-compose.yml file:

version: '3.7'

services:

  nginx-php-fpm-app:

    image: tiredofit/nginx-php-fpm:8.2-alpine

    volumes:
      - ./html/:/www/html
      - ./logs/:/www/logs
      
    environment:
      - TIMEZONE = Asia/Bahrain
      - PHP_MEMORY_LIMIT = 256M

    ports:
      - 80:80

    restart: always

when viewing PHP info both configuration are still showing the default values:

  • Default timezone: Etc/GMT
  • memory_limit: 128M

Best Regards.

After update to 7.7.4 release getting `No such file or directory in log`

Summary

@tiredofit It seems like // typo

2023-12-10.09:22:39 �[42m[STARTING]�[49m ** [nginx] [1] Starting nginx 1.25.3
 sed: /etc/zabbix//zabbix_agentd.conf: No such file or directory
 sed: /etc/zabbix//zabbix_agentd.conf: No such file or directory
 sed: /etc/zabbix//zabbix_agentd.conf: No such file or directory
 sed: /etc/zabbix//zabbix_agentd.conf: No such file or directory
 2023-12-10.09:22:39 �[42m[STARTING]�[49m ** [php-fpm] [1] Starting php-fpm 8.1.26
 2023-12-10.09:22:39 �[42m[STARTING]�[49m ** [monitoring] [1] Starting Zabbix Agent (modern) 6.4.9
 2023-12-10.09:22:40 �[42m[STARTING]�[49m ** [scheduling] [1] Starting cron
 Couldn't watch /etc/nginx/services.enabled: No such file or directory
 sed: /etc/zabbix//zabbix_agentd.conf: No such file or directory
 sed: /etc/zabbix//zabbix_agentd.conf: No such file or directory
 sed: /etc/zabbix//zabbix_agentd.conf: No such file or directory
 sed: /etc/zabbix//zabbix_agentd.conf: No such file or directory
 2023-12-10.09:22:41 �[42m[STARTING]�[49m ** [monitoring] [2] Starting Zabbix Agent (modern) 6.4.9
 2023-12-10.09:22:41 �[42m[STARTING]�[49m ** [logging] [1] [logship] Starting fluent-bit 2.2.0
 Couldn't watch /etc/nginx/services.enabled: No such file or directory
 sed: /etc/zabbix//zabbix_agentd.conf: No such file or directory
 sed: /etc/zabbix//zabbix_agentd.conf: No such file or directory
 sed: /etc/zabbix//zabbix_agentd.conf: No such file or directory
 sed: /etc/zabbix//zabbix_agentd.conf: No such file or directory

Cannot change the gid of nginx user

I am trying to change the gid to 1001 as described in Permissions' section of https://hub.docker.com/r/tiredofit/alpine. I copy from the documentation:

If you enable DEBUG_PERMISSIONS=TRUE all the users and groups have been modified in accordance with environment variables will be displayed in output. e.g. If you add USER_NGINX=1000 it will reset the containers nginx user id from 82 to 1000 - Hint, also change the Group ID to your local development users UID & GID and avoid Docker permission issues when developing.

As @tiredofit says at #11 (comment) i tried ENABLE_PERMISSIONS=TRUE and comment # - DEBUG_PERMISSIONS=TRUE.

I tried every combination i could think but the same result. The gid is "stuck" to 33.

My configuration is the following

version: '3.9'
services:
        nginx-php-fpm:
                image: tiredofit/nginx-php-fpm:5.6
                restart: unless-stopped
                container_name: example.com
                volumes:
                - ./html:/www/html
                - ./logs:/www/logs
                environment:
                - VIRTUAL_HOST=example.com
                - VIRTUAL_NETWORK=proxy_default
                - VIRTUAL_PORT=80
                - DEBUG_PERMISSIONS=TRUE
                - ENABLE_PERMISSIONS=TRUE
                - USER_NGINX=1000
                - GROUP_WWW-DATA=1001
networks:
        default:
                external:
                        name: proxy_default

add a flag to disable php-fpm logs

When using nginx+php-fpm together, both nginx logs and php-fpm logs are recorded, and the logs data is almost the same.
This is waste of disk space somehow.

So it's better to add a flag to disable php-fpm logs, and disable php-fpm logs by default.

5.6:alpine has issues with new nginx version (`events` directive missing) and php-fpm not starting properly

Summary

Hi, I have two issues with 5.6:alpine:

  1. nginx: [emerg] no "events" section in configuration
  2. php-fpm always restarting (unidentified issue)

Steps to reproduce

Tested with this docker-compose.yml

version: '3'

services:
  wp:
    container_name: test-image
    platform: linux/x86_64
    image: tiredofit/nginx-php-fpm:5.6-alpine
    ports:
      - '80'
    restart: always
    environment:
      USER_nginx: '1000' # = ubuntu uid on the host
      GROUP_www-data: '1001' # = www gid on the host

I'm testing this on a M1 Mac, so i need to emulate the platform (see the line in the compose).
However, I've tested this also on an ubuntu 22 server and it has the same behaviour.

What is the expected correct behavior?

Nginx and php-fpm up and running.

Relevant logs and/or screenshots

Attaching to test-image
test-image  | /package/admin/s6-overlay/libexec/preinit: notice: /var/run is not a symlink to /run, fixing it
test-image  | s6-linux-init: warning: parent wrote to fd 3!
test-image  |                                                                        ,---.
test-image  | ,--------.,--.                 ,--.            ,---.    ,--. ,--------.|   |
test-image  | '--.  .--'`--',--.--. ,---.  ,-|  |     ,---. /  .-'    |  | '--.  .--'|  .'
test-image  |    |  |   ,--.|  .--'| .-. :' .-. |    | .-. ||  `-,    |  |    |  |   |  |
test-image  |    |  |   |  ||  |   \   --.\ `-' |    ' '-' '|  .-'    |  |.--.|  |   `--'
test-image  |    `--'   `--'`--'    `----' `---'      `---' `--'      `--''--'`--'   .--.
test-image  |                                                                        '--'
test-image  | Image:  tiredofit/nginx-php-fpm | Version  7.7.5 Type 'image_changelog' for details
test-image  | Repository/Documentation: https://github.com/tiredofit/docker-nginx-php-fpm/
test-image  | 
test-image  | If this image provides you value  - Consider sponsoring my work for continued 
test-image  | development, timely updates, and feature requests. Commercial support available.
test-image  | 
test-image  |                     More Info:  https://www.tiredofit.ca
test-image  | 
test-image  | 2024-02-16.09:51:14 [NOTICE] ** [monitoring] Container configured for monitoring with 'zabbix classic'
test-image  | 2024-02-16.09:51:15 [NOTICE] ** [scheduling] Container configured for scheduled tasks with 'cron'
test-image  | 2024-02-16.09:51:16 [NOTICE] ** [messaging] Container configured to route mail via SMTP to 'postfix-relay'
test-image  | Error loading shared library libintl.so.8: No such file or directory (needed by /usr/local/bin/envsubst)
test-image  | Error relocating /usr/local/bin/envsubst: libintl_bindtextdomain: symbol not found
test-image  | Error relocating /usr/local/bin/envsubst: libintl_gettext: symbol not found
test-image  | Error relocating /usr/local/bin/envsubst: libintl_textdomain: symbol not found
test-image  | Error loading shared library libintl.so.8: No such file or directory (needed by /usr/local/bin/envsubst)
test-image  | Error relocating /usr/local/bin/envsubst: libintl_bindtextdomain: symbol not found
test-image  | Error relocating /usr/local/bin/envsubst: libintl_gettext: symbol not found
test-image  | Error relocating /usr/local/bin/envsubst: libintl_textdomain: symbol not found
test-image  | Error loading shared library libintl.so.8: No such file or directory (needed by /usr/local/bin/envsubst)
test-image  | Error relocating /usr/local/bin/envsubst: libintl_bindtextdomain: symbol not found
test-image  | Error relocating /usr/local/bin/envsubst: libintl_gettext: symbol not found
test-image  | Error relocating /usr/local/bin/envsubst: libintl_textdomain: symbol not found
test-image  | Error loading shared library libintl.so.8: No such file or directory (needed by /usr/local/bin/envsubst)
test-image  | Error relocating /usr/local/bin/envsubst: libintl_bindtextdomain: symbol not found
test-image  | Error relocating /usr/local/bin/envsubst: libintl_gettext: symbol not found
test-image  | Error relocating /usr/local/bin/envsubst: libintl_textdomain: symbol not found
test-image  | Error loading shared library libintl.so.8: No such file or directory (needed by /usr/local/bin/envsubst)
test-image  | Error relocating /usr/local/bin/envsubst: libintl_bindtextdomain: symbol not found
test-image  | Error relocating /usr/local/bin/envsubst: libintl_gettext: symbol not found
test-image  | Error relocating /usr/local/bin/envsubst: libintl_textdomain: symbol not found
test-image  | Error loading shared library libintl.so.8: No such file or directory (needed by /usr/local/bin/envsubst)
test-image  | Error relocating /usr/local/bin/envsubst: libintl_bindtextdomain: symbol not found
test-image  | Error relocating /usr/local/bin/envsubst: libintl_gettext: symbol not found
test-image  | Error relocating /usr/local/bin/envsubst: libintl_textdomain: symbol not found
test-image  | Error loading shared library libintl.so.8: No such file or directory (needed by /usr/local/bin/envsubst)
test-image  | Error relocating /usr/local/bin/envsubst: libintl_bindtextdomain: symbol not found
test-image  | Error relocating /usr/local/bin/envsubst: libintl_gettext: symbol not found
test-image  | Error relocating /usr/local/bin/envsubst: libintl_textdomain: symbol not found
test-image  | Error loading shared library libintl.so.8: No such file or directory (needed by /usr/local/bin/envsubst)
test-image  | Error relocating /usr/local/bin/envsubst: libintl_bindtextdomain: symbol not found
test-image  | Error relocating /usr/local/bin/envsubst: libintl_gettext: symbol not found
test-image  | Error relocating /usr/local/bin/envsubst: libintl_textdomain: symbol not found
test-image  | Error loading shared library libintl.so.8: No such file or directory (needed by /usr/local/bin/envsubst)
test-image  | Error relocating /usr/local/bin/envsubst: libintl_bindtextdomain: symbol not found
test-image  | Error relocating /usr/local/bin/envsubst: libintl_gettext: symbol not found
test-image  | Error relocating /usr/local/bin/envsubst: libintl_textdomain: symbol not found
test-image  | Error loading shared library libintl.so.8: No such file or directory (needed by /usr/local/bin/envsubst)
test-image  | Error relocating /usr/local/bin/envsubst: libintl_bindtextdomain: symbol not found
test-image  | Error relocating /usr/local/bin/envsubst: libintl_gettext: symbol not found
test-image  | Error relocating /usr/local/bin/envsubst: libintl_textdomain: symbol not found
test-image  | Error loading shared library libintl.so.8: No such file or directory (needed by /usr/local/bin/envsubst)
test-image  | Error relocating /usr/local/bin/envsubst: libintl_bindtextdomain: symbol not found
test-image  | Error relocating /usr/local/bin/envsubst: libintl_gettext: symbol not found
test-image  | Error relocating /usr/local/bin/envsubst: libintl_textdomain: symbol not found
test-image  | Error loading shared library libintl.so.8: No such file or directory (needed by /usr/local/bin/envsubst)
test-image  | Error relocating /usr/local/bin/envsubst: libintl_bindtextdomain: symbol not found
test-image  | Error relocating /usr/local/bin/envsubst: libintl_gettext: symbol not found
test-image  | Error relocating /usr/local/bin/envsubst: libintl_textdomain: symbol not found
test-image  | Error loading shared library libintl.so.8: No such file or directory (needed by /usr/local/bin/envsubst)
test-image  | Error relocating /usr/local/bin/envsubst: libintl_bindtextdomain: symbol not found
test-image  | Error relocating /usr/local/bin/envsubst: libintl_gettext: symbol not found
test-image  | Error relocating /usr/local/bin/envsubst: libintl_textdomain: symbol not found
test-image  | /assets/functions/20-php-fpm: line 109: /etc/php//conf.d/99-smtp.ini: No such file or directory
test-image  | /assets/functions/20-php-fpm: line 111: /etc/php//conf.d/99-timezone.ini: No such file or directory
test-image  | 2024-02-16.09:51:23 [NOTICE] ** [php-fpm] Creating sample index.php
test-image  | Error loading shared library libintl.so.8: No such file or directory (needed by /usr/local/bin/envsubst)
test-image  | Error relocating /usr/local/bin/envsubst: libintl_bindtextdomain: symbol not found
test-image  | Error relocating /usr/local/bin/envsubst: libintl_gettext: symbol not found
test-image  | Error relocating /usr/local/bin/envsubst: libintl_textdomain: symbol not found
test-image  | cp: can't create '/etc/php//': Is a directory
test-image  | cp: can't create '/etc/php//mods-available/apcu.ini': No such file or directory
test-image  | cp: can't create '/etc/php//mods-available/opcache.ini': No such file or directory
test-image  | cp: can't create '/etc/php//': Is a directory
test-image  | 2024-02-16.09:51:23 [ERROR] ** [php-fpm] Requested enabling apcu however it doesn't exist!
test-image  | 2024-02-16.09:51:23 [ERROR] ** [php-fpm] Requested enabling bcmath however it doesn't exist!
test-image  | 2024-02-16.09:51:23 [ERROR] ** [php-fpm] Requested enabling bz2 however it doesn't exist!
test-image  | 2024-02-16.09:51:23 [ERROR] ** [php-fpm] Requested enabling ctype however it doesn't exist!
test-image  | 2024-02-16.09:51:23 [ERROR] ** [php-fpm] Requested enabling curl however it doesn't exist!
test-image  | 2024-02-16.09:51:23 [ERROR] ** [php-fpm] Requested enabling dom however it doesn't exist!
test-image  | 2024-02-16.09:51:24 [ERROR] ** [php-fpm] Requested enabling exif however it doesn't exist!
test-image  | 2024-02-16.09:51:24 [ERROR] ** [php-fpm] Requested enabling fileinfo however it doesn't exist!
test-image  | 2024-02-16.09:51:24 [ERROR] ** [php-fpm] Requested enabling gd however it doesn't exist!
test-image  | 2024-02-16.09:51:24 [ERROR] ** [php-fpm] Requested enabling iconv however it doesn't exist!
test-image  | 2024-02-16.09:51:24 [ERROR] ** [php-fpm] Requested enabling imap however it doesn't exist!
test-image  | 2024-02-16.09:51:24 [ERROR] ** [php-fpm] Requested enabling intl however it doesn't exist!
test-image  | 2024-02-16.09:51:24 [ERROR] ** [php-fpm] Requested enabling json however it doesn't exist!
test-image  | 2024-02-16.09:51:24 [ERROR] ** [php-fpm] Requested enabling mbstring however it doesn't exist!
test-image  | 2024-02-16.09:51:24 [ERROR] ** [php-fpm] Requested enabling mysqli however it doesn't exist!
test-image  | 2024-02-16.09:51:24 [ERROR] ** [php-fpm] Requested enabling mysqlnd however it doesn't exist!
test-image  | 2024-02-16.09:51:24 [ERROR] ** [php-fpm] Requested enabling opcache however it doesn't exist!
test-image  | 2024-02-16.09:51:24 [ERROR] ** [php-fpm] Requested enabling openssl however it doesn't exist!
test-image  | 2024-02-16.09:51:24 [ERROR] ** [php-fpm] Requested enabling pdo however it doesn't exist!
test-image  | 2024-02-16.09:51:24 [ERROR] ** [php-fpm] Requested enabling pdo_mysql however it doesn't exist!
test-image  | 2024-02-16.09:51:24 [ERROR] ** [php-fpm] Requested enabling pgsql however it doesn't exist!
test-image  | 2024-02-16.09:51:24 [ERROR] ** [php-fpm] Requested enabling phar however it doesn't exist!
test-image  | 2024-02-16.09:51:24 [ERROR] ** [php-fpm] Requested enabling session however it doesn't exist!
test-image  | 2024-02-16.09:51:24 [ERROR] ** [php-fpm] Requested enabling simplexml however it doesn't exist!
test-image  | 2024-02-16.09:51:24 [ERROR] ** [php-fpm] Requested enabling tokenizer however it doesn't exist!
test-image  | 2024-02-16.09:51:24 [ERROR] ** [php-fpm] Requested enabling xml however it doesn't exist!
test-image  | 2024-02-16.09:51:25 [ERROR] ** [php-fpm] Requested enabling xmlreader however it doesn't exist!
test-image  | 2024-02-16.09:51:25 [ERROR] ** [php-fpm] Requested enabling xmlwriter however it doesn't exist!
test-image  | chmod: /etc/php/: No such file or directory
test-image  | chown: /etc/php/: No such file or directory
test-image  | 2024-02-16.09:51:26 [STARTING] ** [nginx] [1] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:51:26 [STARTING] ** [php-fpm] [1] Starting php-fpm 
test-image  | 2024-02-16.09:51:27 [STARTING] ** [monitoring] [1] Starting Zabbix Agent (classic) 6.4.11
test-image  | 2024-02-16.09:51:27 [STARTING] ** [scheduling] [1] Starting cron
test-image  | 2024-02-16.09:51:27 [STARTING] ** [nginx] [2] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:51:28 [STARTING] ** [php-fpm] [2] Starting php-fpm 
test-image  | 2024-02-16.09:51:29 [STARTING] ** [nginx] [3] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:51:29 [STARTING] ** [php-fpm] [3] Starting php-fpm 
test-image  | 2024-02-16.09:51:30 [STARTING] ** [nginx] [4] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:51:30 [STARTING] ** [php-fpm] [4] Starting php-fpm 
test-image  | 2024-02-16.09:51:31 [STARTING] ** [nginx] [5] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:51:32 [STARTING] ** [php-fpm] [5] Starting php-fpm 
test-image  | 2024-02-16.09:51:33 [STARTING] ** [nginx] [6] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:51:33 [STARTING] ** [php-fpm] [6] Starting php-fpm 
test-image  | 2024-02-16.09:51:34 [STARTING] ** [nginx] [7] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:51:35 [STARTING] ** [php-fpm] [7] Starting php-fpm 
test-image  | 2024-02-16.09:51:35 [STARTING] ** [nginx] [8] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:51:36 [STARTING] ** [php-fpm] [8] Starting php-fpm 
test-image  | 2024-02-16.09:51:37 [STARTING] ** [nginx] [9] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:51:37 [STARTING] ** [php-fpm] [9] Starting php-fpm 
test-image  | 2024-02-16.09:51:38 [STARTING] ** [nginx] [10] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:51:39 [STARTING] ** [php-fpm] [10] Starting php-fpm 
test-image  | 2024-02-16.09:51:39 [STARTING] ** [nginx] [11] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:51:40 [STARTING] ** [php-fpm] [11] Starting php-fpm 
test-image  | 2024-02-16.09:51:41 [STARTING] ** [nginx] [12] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:51:42 [STARTING] ** [php-fpm] [12] Starting php-fpm 
test-image  | 2024-02-16.09:51:42 [STARTING] ** [nginx] [13] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:51:43 [STARTING] ** [php-fpm] [13] Starting php-fpm 
test-image  | 2024-02-16.09:51:43 [STARTING] ** [nginx] [14] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:51:45 [STARTING] ** [php-fpm] [14] Starting php-fpm 
test-image  | 2024-02-16.09:51:45 [STARTING] ** [nginx] [15] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:51:46 [STARTING] ** [php-fpm] [15] Starting php-fpm 
test-image  | 2024-02-16.09:51:46 [STARTING] ** [nginx] [16] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:51:48 [STARTING] ** [nginx] [17] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:51:48 [STARTING] ** [php-fpm] [16] Starting php-fpm 
test-image  | 2024-02-16.09:51:49 [STARTING] ** [nginx] [18] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:51:49 [STARTING] ** [php-fpm] [17] Starting php-fpm 
test-image  | 2024-02-16.09:51:50 [STARTING] ** [nginx] [19] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:51:51 [STARTING] ** [php-fpm] [18] Starting php-fpm 
test-image  | 2024-02-16.09:51:52 [STARTING] ** [nginx] [20] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:51:52 [STARTING] ** [php-fpm] [19] Starting php-fpm 
test-image  | 2024-02-16.09:51:53 [STARTING] ** [nginx] [21] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:51:53 [STARTING] ** [php-fpm] [20] Starting php-fpm 
test-image  | 2024-02-16.09:51:54 [STARTING] ** [nginx] [22] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:51:55 [STARTING] ** [php-fpm] [21] Starting php-fpm 
test-image  | 2024-02-16.09:51:56 [STARTING] ** [nginx] [23] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:51:56 [STARTING] ** [php-fpm] [22] Starting php-fpm 
test-image  | 2024-02-16.09:51:57 [STARTING] ** [nginx] [24] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:51:58 [STARTING] ** [php-fpm] [23] Starting php-fpm 
test-image  | 2024-02-16.09:51:58 [STARTING] ** [nginx] [25] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:51:59 [STARTING] ** [php-fpm] [24] Starting php-fpm 
test-image  | 2024-02-16.09:51:59 [STARTING] ** [nginx] [26] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:52:00 [STARTING] ** [php-fpm] [25] Starting php-fpm 
test-image  | 2024-02-16.09:52:01 [STARTING] ** [nginx] [27] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:52:02 [STARTING] ** [php-fpm] [26] Starting php-fpm 
test-image  | 2024-02-16.09:52:02 [STARTING] ** [nginx] [28] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:52:03 [STARTING] ** [php-fpm] [27] Starting php-fpm 
test-image  | 2024-02-16.09:52:04 [STARTING] ** [nginx] [29] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:52:05 [STARTING] ** [php-fpm] [28] Starting php-fpm 
test-image  | 2024-02-16.09:52:05 [STARTING] ** [nginx] [30] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:52:06 [STARTING] ** [php-fpm] [29] Starting php-fpm 
test-image  | 2024-02-16.09:52:06 [STARTING] ** [nginx] [31] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:52:08 [STARTING] ** [nginx] [32] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:52:08 [STARTING] ** [php-fpm] [30] Starting php-fpm 
test-image  | 2024-02-16.09:52:09 [STARTING] ** [nginx] [33] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:52:10 [STARTING] ** [php-fpm] [31] Starting php-fpm 
test-image  | 2024-02-16.09:52:10 [STARTING] ** [nginx] [34] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:52:11 [STARTING] ** [php-fpm] [32] Starting php-fpm 
test-image  | 2024-02-16.09:52:12 [STARTING] ** [nginx] [35] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:52:12 [STARTING] ** [php-fpm] [33] Starting php-fpm 
test-image  | 2024-02-16.09:52:13 [STARTING] ** [nginx] [36] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:52:14 [STARTING] ** [php-fpm] [34] Starting php-fpm 
test-image  | 2024-02-16.09:52:14 [STARTING] ** [nginx] [37] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:52:15 [STARTING] ** [php-fpm] [35] Starting php-fpm 
test-image  | 2024-02-16.09:52:16 [STARTING] ** [nginx] [38] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:52:17 [STARTING] ** [php-fpm] [36] Starting php-fpm 
test-image  | 2024-02-16.09:52:17 [STARTING] ** [nginx] [39] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:52:18 [STARTING] ** [php-fpm] [37] Starting php-fpm 
test-image  | 2024-02-16.09:52:18 [STARTING] ** [nginx] [40] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:52:20 [STARTING] ** [php-fpm] [38] Starting php-fpm 
test-image  | 2024-02-16.09:52:20 [STARTING] ** [nginx] [41] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:52:21 [STARTING] ** [nginx] [42] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:52:21 [STARTING] ** [php-fpm] [39] Starting php-fpm 
test-image  | 2024-02-16.09:52:22 [STARTING] ** [nginx] [43] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:52:22 [STARTING] ** [php-fpm] [40] Starting php-fpm 
test-image  | 2024-02-16.09:52:24 [STARTING] ** [nginx] [44] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:52:24 [STARTING] ** [php-fpm] [41] Starting php-fpm 
test-image  | 2024-02-16.09:52:25 [STARTING] ** [nginx] [45] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:52:25 [STARTING] ** [php-fpm] [42] Starting php-fpm 
test-image  | 2024-02-16.09:52:26 [STARTING] ** [nginx] [46] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:52:27 [STARTING] ** [php-fpm] [43] Starting php-fpm 
test-image  | 2024-02-16.09:52:28 [STARTING] ** [nginx] [47] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:52:28 [STARTING] ** [php-fpm] [44] Starting php-fpm 
test-image  | 2024-02-16.09:52:29 [STARTING] ** [nginx] [48] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:52:30 [STARTING] ** [php-fpm] [45] Starting php-fpm 
test-image  | 2024-02-16.09:52:30 [STARTING] ** [nginx] [49] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:52:31 [STARTING] ** [php-fpm] [46] Starting php-fpm 
test-image  | 2024-02-16.09:52:32 [STARTING] ** [nginx] [50] Starting nginx 1.25.3
test-image  | nginx: [emerg] no "events" section in configuration
test-image  | 2024-02-16.09:52:33 [STARTING] ** [php-fpm] [47] Starting php-fpm 
test-image  | 2024-02-16.09:52:33 [ERROR] ** [nginx] POTENTIAL RUNWAY DETECTECTED: Disabling 10-nginx service because it has tried restarting '50' times
test-image  | 2024-02-16.09:52:34 [STARTING] ** [php-fpm] [48] Starting php-fpm 
test-image  | 2024-02-16.09:52:35 [STARTING] ** [php-fpm] [49] Starting php-fpm 
test-image  | 2024-02-16.09:52:37 [STARTING] ** [php-fpm] [50] Starting php-fpm 
test-image  | s6-applyuidgid: fatal: unable to exec php-fpm: No such file or directory
test-image  | 2024-02-16.09:52:38 [ERROR] ** [php-fpm] POTENTIAL RUNWAY DETECTECTED: Disabling 20-php-fpm service because it has tried restarting '50' times

Possible fixes

The nginx events error seems an easy fix
https://stackoverflow.com/questions/54481423/nginx-startup-prompt-emerg-no-events-section-in-configuration

I don't know how to fix the php-fpm error
I get not found, trying to call it inside the container, but I'm not familiar with alpine at all

[tiredofit/nginx-php-fpm:7.7.5 10:50:08 /] $ php-fpm
bash: php-fpm: command not found
[tiredofit/nginx-php-fpm:7.7.5 10:50:10 /] $ php-fpm5
bash: php-fpm5: command not found

Thanks for the commitment! These images are great and reliable.

Trouble to use php-redis

Hi Dave,

I'm using your docker-files and activate php-redis with PHP_ENABLE_REDIS=true on the environment. But if I'm login into bash and execute a php script i got the following error:

$ bin/console help
PHP Warning:  PHP Startup: Unable to load dynamic library 'redis.so' (tried: /usr/lib/php/20220829/redis.so (/usr/lib/php/20220829/redis.so: undefined symbol: igbinary_serialize), /usr/lib/php/20220829/redis.so.so (/usr/lib/php/20220829/redis.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

Have you any idea?

Log buffer is full, therefore, not showing log.

Summary

The php-fpm log is not showing since the log_limit buffer is using the default 1024 characters. When the log exceeds that limit The access log request is truncated.

Steps to reproduce

View logs that are being reported in php-fpm.

What is the expected correct behavior?

Logs should contain the proper information. See the current output in the Environment/logs section below.

Relevant logs and/or screenshots

N/A

Environment

  • Image version / tag: tiredofit/wordpress Built based on: tiredofit/nginx-php-fpm:alpine-8.0

  • Host OS: archlinux

Any logs | docker-compose.yml Logs output: [14-Oct-2021 10:54:57] WARNING: [pool www] child 32024 said into stderr: "NOTICE: the log buffer is full (1024). The access log request has been truncated."

Possible fixes

Adding log_limit in php-fpm.conf to be greater than 1024.
eg. log_limit = 2048
reference: https://www.php.net/manual/en/install.fpm.configuration.php

Security Vulnerability: NGINX Configuration Allows Unrestricted Access to PHP Files in Specified Directories

Issue Description:

When the location ~* /(?:uploads|files)/.*\.php$ block is placed below the location ~ \.php(/|$) block in the NGINX configuration, it allows access to PHP files in the specified directories. Moving this block above the PHP location block resolves the issue.

Configuration:

server {
    listen {{NGINX_LISTEN_PORT}};
    server_name localhost;
    root {{NGINX_WEBROOT}};

    index index.php index.html index.htm;

    # Deny access to any files with a .php extension in the uploads directory
    location ~* /(?:uploads|files)/.*\.php$ {
        deny all;
    }

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php(/|$) {
        include /etc/nginx/snippets/php-fpm.conf;
        fastcgi_split_path_info ^(.+?\.php)(/.+)$;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }

    include /etc/nginx/snippets/site_optimization.conf;
    include /etc/nginx/snippets/exploit_protection.conf;
}

Steps to Reproduce:

  1. Configure NGINX with the provided configuration.
  2. Attempt to access a PHP file in the /uploads or /files directory.
  3. Observe that access is allowed when the location ~* /(?:uploads|files)/.*\.php$ block is below the PHP location block.

Expected Behavior:

Access to PHP files in the specified directories should be denied regardless of the order of the location blocks.

Actual Behavior:

When the location ~* /(?:uploads|files)/.*\.php$ block is placed below the PHP location block, it allows access to PHP files in the specified directories.

Container cant start with nginx-php-fpm:8.2-alpine_edge-7.4.0 as base image

Summary

With tiredofit/nginx-php-fpm:8.2-alpine_edge-7.4.0 base image container is hanging on and can't start.

2023-01-16 11:57:12 sed: -i requires an argument
2023-01-16 11:57:12 /assets/functions/20-php-fpm: line 240: /assets/php-fpm/mods-available/opcache.ini: Permission denied
2023-01-16 11:57:12 sed: -i requires an argument
2023-01-16 11:57:12 /assets/functions/20-php-fpm: line 248: /assets/php-fpm/mods-available/opcache.ini: Permission denied
2023-01-16 11:57:12 sed: /assets/php-fpm/mods-available/acpu.ini: No such file or directory

Shared folders have 'systemd-resolved' as user:group

Hi,

with a configuration like this

version: '3'

services:
  wordpress:
    image: tiredofit/nginx-php-fpm:5.6-latest
    working_dir: /www/html
    volumes:
      - ./wordpress:/www/html

on Ubuntu 18.04, the folder "wordpress" and all of its subfolders automatically become owned by 'systemd-resolved'

Why is it happening?

I would like the shared folders to keep the original permissions (like ubuntu:ubuntu)

Thanks

How to add to the crontab

Hello,

I see that cron is automatically starting up in the container, and i'm wondering what the best way to add to the crontab is?

I have tried adding the following to our Dockerfile, in the hopes of kicking off laravel's task scheduler.

# CRONTAB
ARG CRONTAB_DESTINATION=/etc/cron.d/crontab
COPY ./docker/staging/crontab ${CRONTAB_DESTINATION}

And here is what is in that crontab:
* * * * * php /www/html/artisan schedule:run >> /dev/stdout 2>&1

However, when the server boots up, crontab -l only shows the 'logrotate' cron item.

Is there a different way I should be adding to the crontab?

Thanks in advance!!

best way to setup papertrail...

Hello,

i am planning on setting up papertrail to watch for all system logs. I'd love for nginx logs, php logs, and application logs to all go to papertail.

According to https://docs.docker.com/config/containers/logging/syslog/ - it looks like it's possible to send all syslogs to a forwarded adddress/port, which is also what papertail says to do.

I haven't actually attempted to add this to my Dockerfile yet. Since you have such an opinionated docker container (which i love by the way!) i thought i'd ask before installing. How do you recommend doing it?

Best way to push logs to stdout/stderr ?

Hello,

what is the recommended method for pushing logs to /dev/stdout ?

I tried this method:

RUN ln -sf /dev/stdout /www/logs/php-fpm/access.log
RUN ln -sf /dev/stdout /www/logs/php-fpm/error.log

But that results in an error that the files/folders there don't exist. Maybe they are created after logs start?

Let me know if there is a standardized way to do this.

Thanks!

Add default index.php file for testing stock image

Description of the feature
Add a default index.php file at /www/html/ for nginx-php-fpm images. Currently when the stock php image is spun up (tiredofit/nginx-php-fpm:8.1-alpine freshly pulled for 5day old image), I see a 403 Forbidden page and receive a 403 error code.

Upon inspection, there is no default index file like the one in your nginx image.
I tested by running echo "<h1>TESTING</h1>" > /www/html/index.php inside the container. This then returned a 200 code and helped confirm that the default/stock image was working as expected.

Benftits of feature
This feature would make the nginx and nginx-php-fpm a bit more similar and would enable a more streamlined testing process, one that does not require mapping custom assets or using the php image as a base right away. Instead, the image would server a default page and allow quicker prototyping and testing.

Additional context

image

example compose.yml
services:
  test-php-image:
    #image: tiredofit/nginx-php-fpm:8.1-alpine 
    image: tiredofit/nginx-php-fpm:8.1-alpine-7.5.1 # issue also present 4 months ago
    container_name: test-php-image
    labels:
      - traefik.enable=true
      - traefik.http.routers.test-php-image.rule=Host(`test-php-image.example.com`)
      - traefik.http.services.test-php-image.loadbalancer.server.port=80
    volumes:
      - ./logs:/www/logs
    environment:
      - CONTAINER_NAME=test-php-image
      - DEBUG_MODE=FALSE

        #- NGINX_AUTHENTICATION_TYPE=LLNG
        #- NGINX_AUTHENTICATION_LLNG_ATTRIBUTE1=HTTP_AUTH_USER,uid,upstream_http_uid
        #- NGINX_AUTHENTICATION_LLNG_ATTRIBUTE2=HTTP_AUTH_GROUPS,groups,upstream_http_groups

    networks:
      - services
      - proxy
    restart: always

networks:
  proxy:
    external: true
  services:
    external: true

Where to override ENTRYPOINT ?

This is a really great project (as are all your docker builds). Thanks!

I realize this question might seem intuitive, but I would like to override the ENTRYPOINT.

I'd like to add a few laravel specific php commands ('php artisan config:cache', etc) before whatever command is provisioning php/nginx.

What is in the current entrypoint or cmd that is being used?

Thanks in advance!

php-fpm not behaving properly

I am using the tiredofit/fusiondirectory image that is based on this one and for some reason php-fpm is not behaving properly.

I'm getting these logs every second after 23:59 on the day starting the image:

[10-Jun-2020 23:59:00] ERROR: unable to bind listening socket for address '0.0.0.0:9000': Address in use (98)
[10-Jun-2020 23:59:00] ERROR: FPM initialization failed
[10-Jun-2020 23:59:01] ERROR: unable to bind listening socket for address '0.0.0.0:9000': Address in use (98)
[10-Jun-2020 23:59:01] ERROR: FPM initialization failed

Might be a problem with s6 not stopping fpm properly before rotating the logs?

Modifying other php.ini params

Hi David how are ya ? happy new year !!

Last week I had to do a security audit of some sites and on the report, a couple issues came along that to fix them a couple options in php.ini can me added. Their about cookie security, the httpOnly set-cookie response header and secure cookie attribute.

They can be configured by setting the session.http_only and session.cookie_secure respectively in php.ini.

What do you think about this ? could it be possible to have some options to increase security and enable this parameters ?

Thanks.

SSL HTTPS 443 port

Hello,

i use https://github.com/jwilder/nginx-proxy for nginx proxy and this container for serving content. I use Let'sEncrypt SSL certificate so i need the proxy to call <my_docker_ipAddress>:443

But in this container only 80 is exposed. If i use in my docker-compose.yml file

ports:
  - "443"

i get a 503 Bad Gateway. I suppose this is happening because it doesn't know where to go in this container through port 443.

opcache.max_accelerated_files=5413

Description of the feature
currently, opcache.max_accelerated_files seems to have a fixed value. My nextcloud is complaining that the #of files in the cache exceeds this limit. Would it be possible to make this parameter configurable (maybe along with some other .ini parameters)?

Beneftits of feature
Bigger sites might benefit from opcache and other .ini tuning settings

Changing the id of nginx user and group

Hi David,

I have a mix of websites, some use tiredofit/wordpress and some use other images. The user and group id's of the web server user of the images is different, so they map to different host o.s. users. Then I have a o.s. user for the webmasters team that administer all of the sites that sftp access only, and sometimes they wipe out one of the sites and add them again, so the files get created with their user's group that sometimes does not match the uid/gid of the website running the container and I have to go and fix the permissions for them. With docker you can set the uid/gid of the user running the container but AFAICS this does not work on this case because that user is the one running s6 init, so this has to be done at run time when starting the container for the nginx user using usermod.

Could a couple variables like NGINX_USER=uid"" and NGINX_GROUP="gid" (or NGINX_USER="uid:gid" could work too) could be added to set the nginx user uid/gid values ?

Trouble Enabling Redis

Hello,

i'm having trouble enabling the REDIS PHP Extension on a container.

Summary

using PHP_ENABLE_REDIS=TRUE
shows the following error when booting up the container.

laravel.test_1 | 2022-03-17.15:08:15 [ERROR] ** [php-fpm] Requested enabling redis however it doesn't exist!

and this error on the site:

Please make sure the PHP Redis extension is installed and enabled.

Config:

Dockerfile:

FROM tiredofit/nginx-php-fpm:debian-8.1 as base

WORKDIR /www/html

RUN php-ext enable pdo_sqlite \
    && php-ext enable sqlite3 \
    && php-ext enable zip \
    && php-ext enable sockets

RUN useradd -ms /bin/bash --no-user-group -g www-data -u 1337 sail

docker-compose.yaml:

version: '3.7'
services:
  laravel.test:
    build:
      context: .
      dockerfile: ./docker/development/Dockerfile
    extra_hosts:
      - 'host.docker.internal:host-gateway'
    labels:
      caddy: dev.mysite.care
      caddy.reverse_proxy: "{{upstreams 8080}}"
      caddy.tls: "/data/dev.mysite.care.pem /data/dev.mysite.care-key.pem"
    environment:
      LARAVEL_SAIL: 1
      XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}'
      XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}'
      NGINX_LISTEN_PORT: '${NGINX_LISTEN_PORT:-8080}'
      NGINX_WEBROOT: '${NGINX_WEBROOT:-/www/html/public}'
      NGINX_ENABLE_COMPRESSION_GZIP: '${NGINX_ENABLE_COMPRESSION_GZIP:-TRUE}'
      CONTAINER_LOG_LEVEL: '${CONTAINER_LOG_LEVEL:-DEBUG}'
      PHP_ENABLE_OPENSSL: '${PHP_ENABLE_OPENSSL:-FALSE}'
      PHP_ENABLE_REDIS: '${PHP_ENABLE_REDIS:-TRUE}'
      # PHP_LOG_LEVEL: '${PHP_LOG_LEVEL:-debug}'
      # PHP_LOG_LOCATION: '${PHP_LOG_LOCATION:-/dev}'
      # PHP_LOG_ACCESS_FILE: '${PHP_LOG_ACCESS_FILE:-stdout}'
      # PHP_LOG_ERROR_FILE: '${PHP_LOG_ERROR_FILE:-stderr}'
      # PHP_FPM_POST_INIT_SCRIPT: '${PHP_FPM_POST_INIT_SCRIPT}'
      # CRON_ARTISAN: '${CRON_ARTISAN}'
    volumes:
      - '.:/www/html'
    networks:
      - caddy
      - sail
    depends_on:
      - mysql
      - redis
  mysql:
    image: 'mysql/mysql-server:8.0'
    ports:
      - '${FORWARD_DB_PORT:-3306}:3306'
    environment:
      MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
      MYSQL_ROOT_HOST: "%"
      MYSQL_DATABASE: '${DB_DATABASE}'
      MYSQL_USER: '${DB_USERNAME}'
      MYSQL_PASSWORD: '${DB_PASSWORD}'
      MYSQL_ALLOW_EMPTY_PASSWORD: 1
    volumes:
      - 'sailmysql:/var/lib/mysql'
    networks:
      - sail
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-p${DB_PASSWORD}"]
      retries: 3
      timeout: 5s
  redis:
    image: 'redis:alpine'
    ports:
      - '${FORWARD_REDIS_PORT:-6379}:6379'
    volumes:
      - 'sailredis:/data'
    networks:
      - sail
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      retries: 3
      timeout: 5s
networks:
  caddy:
    external: true
  sail:
    driver: bridge
volumes:
  sailmysql:
    driver: local
  sailredis:
    driver: local

Thanks in advance!!

Server NGINX won't start up

Summary

We have a production server, running in an aws ecs container, which restarted last week, and started giving us the below error:

[42m[STARTING]�[49m ** [nginx] [33] Starting nginx 1.23.0
nginx: [emerg] open() "/etc/nginx/nginx.conf.d/site_optimization.conf" failed (2: No such file or directory) in /etc/nginx/sites.available/default.conf:29
This happens at the very beginning of the cycle. We have tried restarting

Here is our Dockerfile:

FROM tiredofit/nginx-php-fpm:debian-8.1

# Set Working Directory
WORKDIR /www/html

RUN php-ext enable pdo_sqlite \
    && php-ext enable sqlite3 \
    && php-ext enable zip \
    && php-ext enable sockets

# Install NPM
RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - \
    && apt-get install -y nodejs \
    && npm install -g npm

# Copy Files
COPY --chown=www-data:www-data . /www/html
RUN chmod -R 775 /www/html/storage

# Run Composer Install
RUN composer install \
    --no-interaction \
    --no-plugins \
    --no-scripts \
    --no-dev \
    --prefer-dist

# RUN NPM - removing in case this is an issue on staging. 
RUN npm install --only=production --prefer-offline --no-audit \
    && npm run production

2 follow up questions:

Is there an immediate fix within the container (ie steps to remove site_optimization and restart nginx - which we're having a hard time doing)

Long term fix.

Thanks in advance!

`nginx` startup error

Summary

Websites return 502 due to Nginx startup error.

Steps to reproduce

  1. Use the newly built image.
  2. Startup the service and read docker-compose logs.

What is the expected correct behavior?

The site should serve via its URL.

Relevant logs and/or screenshots

2022-07-05.20:10:05 [NOTICE] ** [php-fpm] PHP-FPM Preparing to start with the following plugins enabled:  apcu bcmath bz2 ctype curl dom exif fileinfo gd iconv igbinary imap intl mbstring mysqli mysqlnd opcache openssl pdo pdo_mysql pgsql phar redis session simplexml tokenizer xml xmlreader xmlwriter
2022-07-05.20:10:05 [INFO] ** [wordpress] Wordpress Initialization Complete, now starting webserver and PHP engine
2022-07-05.20:10:05 [STARTING] ** [nginx] [1] Starting nginx 1.23.0
nginx: [emerg] open() "/etc/nginx/nginx.conf.d/blockbots/globalblacklist.conf" failed (2: No such file or directory) in /etc/nginx/snippets/bot_blocker.conf:7
2022-07-05.20:10:05 [STARTING] ** [monitoring] [1] Starting Zabbix Agent (modern) 6.0.6
2022-07-05.20:10:05 [STARTING] ** [php-fpm] [1] Starting php-fpm 8.1.7
2022-07-05.20:10:05 [STARTING] ** [scheduling] [1] Starting cron
2022-07-05.20:10:06 [STARTING] ** [nginx] [2] Starting nginx 1.23.0
nginx: [emerg] open() "/etc/nginx/nginx.conf.d/blockbots/globalblacklist.conf" failed (2: No such file or directory) in /etc/nginx/snippets/bot_blocker.conf:7
2022-07-05.20:10:06 [STARTING] ** [logging] [1] [logship] Starting fluent-bit 1.9.5
2022-07-05.20:10:07 [STARTING] ** [nginx] [3] Starting nginx 1.23.0
nginx: [emerg] open() "/etc/nginx/nginx.conf.d/blockbots/globalblacklist.conf" failed (2: No such file or directory) in /etc/nginx/snippets/bot_blocker.conf:7
2022-07-05.20:10:08 [STARTING] ** [nginx] [4] Starting nginx 1.23.0
nginx: [emerg] open() "/etc/nginx/nginx.conf.d/blockbots/globalblacklist.conf" failed (2: No such file or directory) in /etc/nginx/snippets/bot_blocker.conf:7
2022-07-05.20:10:09 [STARTING] ** [nginx] [5] Starting nginx 1.23.0
nginx: [emerg] open() "/etc/nginx/nginx.conf.d/blockbots/globalblacklist.conf" failed (2: No such file or directory) in /etc/nginx/snippets/bot_blocker.conf:7

Environment

  • Image version / tag: tiredofit/nginx-php-fpm and all related services that build upon it.
  • Host OS: archlinux

Possible fixes

Nginx does not seem to be running - github codespace

Hi buddy,

First of all, thank you for your efforts maintaning this image :D

I am trying to use it as my PHP development enviroment on github codespace, but nginx does not seem to be running.
May you help me on that?

I am attaching some screenshots that may help us:

image

no "infinity sleep" gives the same result.
image

Thanks in advance.,

Want to modify php.ini

Hi,

In one of my project i need to update value of serialize_precision to 16 in php.ini
I am not able to figure it out how I can change this value using your image.

Can you please guide me?

Thanks in advance.

How to add scripts to crontab?

Hi Dave, on this issue #29 you commented to add a script to crontab use CRON_ARTISAN env, but what can i do if I have more than one line to adding?

XDebug not available

Hi Dave,

on my .env file I have enabled XDebug:

...
PHP_ENABLE_XDEBUG=TRUE
PHP_MEMORY_LIMIT=2G
PHP_XDEBUG_MODE=develop
PHP_XDEBUG_CLIENT_HOST=host.docker.internal
PHP_XDEBUG_CLIENT_PORT=9003

my docker-compose.yml:

services:

  php:
    build: ./docker
    container_name: "${PROJECT_NAME}-app"
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=web"
      - "traefik.http.routers.${PROJECT_NAME}.rule=Host(`${PROJECT_NAME}.${DOMAIN_SUFFIX}`)"
    env_file:
      - ./.env
    ports:
      - "9003:9003"
    volumes:
      # Source code
      - ./app:/www/html
    networks:
      frivol:
      web:
        aliases:
          - "${PROJECT_NAME}.${DOMAIN_SUFFIX}"
networks:
  frivol:
    driver: bridge
  web:
    external: true

but xdebug are not available on web and also on cli.

My Dockerfile:

FROM tiredofit/nginx-php-fpm:debian-8.2

# additional ENV vars
ENV NODE_VERSION=20.5.1
ENV NVM_DIR=/root/.nvm

# since we don't use zabbix remove it right away
ENV CONTAINER_ENABLE_MONITORING=false

# Install NVM for node
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
RUN . "$NVM_DIR/nvm.sh" \
    && nvm install ${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" \
    && nvm use v${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" \
    && nvm alias default v${NODE_VERSION}
ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}"

# Install npm and yarn
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN apt update \
    && apt install vim nodejs yarn -y

RUN php-ext enable redis \
    && php-ext enable calendar \
    && php-ext enable zip

I have see an old issue what closed by inactivity for php-5.6. I have also try it to enable byself && php-ext enable xdebug but this also not works.

Unfortunatelly i cannot test it with alpine or other image at time. Do you know what's going wrong here?

02-pdo_pgsql.ini file not generated

Summary

Using tiredofit/nginx-php-fpm:alpine-8.1 (same behavior experienced in the debian image) the PHP file for PDO PostgreSQL integration is not being generated, so PDO does not work for PG (PHP reports an error that the driver is not present).

If you add the file manually to the image at /etc/php81/conf.d/02-pdo_pgsql.ini with the following contents, it works as expected:

extension=pdo_pgsql
;priority=02

Steps to reproduce

Just run the container with default options of PostgreSQL support enabled.

What is the expected correct behavior?

Container should automatically generate this file so that PG can be used from PDO.

Relevant logs and/or screenshots

N/A

Environment

  • tiredofit/nginx-php-fpm:alpine-8.1
  • Docker for Wundows / Windows 10

Possible fixes

setting environment variable PHP_LOG_LEVEL=info causes PHP-FPM to be stated over and over

Summary

Setting environment variable PHP_LOG_LEVEL=info causes PHP-FPM to be started over and over

Steps to reproduce

  1. docker run -e PHP_LOG_LEVEL=info -p 20001:80 -v $HOME/apache1:/www tiredofit/nginx-php-fpm:latest
    ...
    [services.d] starting services
    [services.d] done.
    2021-12-06-16:03:15 [STARTING] ** [nginx] [1] Starting nginx 1.21.4
    2021-12-06-16:03:15 [STARTING] ** [monitoring] [1] Starting Zabbix Agent (modern) 5.4.8
    2021-12-06-16:03:15 [STARTING] ** [php-fpm] [1] Starting php-fpm 8.0.13
    2021-12-06-16:03:15 [STARTING] ** [scheduling] [1] Starting cron
    2021-12-06-16:03:16 [STARTING] ** [php-fpm] [2] Starting php-fpm 8.0.13
    2021-12-06-16:03:17 [STARTING] ** [php-fpm] [3] Starting php-fpm 8.0.13
    2021-12-06-16:03:18 [STARTING] ** [php-fpm] [4] Starting php-fpm 8.0.13
    2021-12-06-16:03:19 [STARTING] ** [php-fpm] [5] Starting php-fpm 8.0.13
    2021-12-06-16:03:20 [STARTING] ** [php-fpm] [6] Starting php-fpm 8.0.13
    2021-12-06-16:03:21 [STARTING] ** [php-fpm] [7] Starting php-fpm 8.0.13
    2021-12-06-16:03:22 [STARTING] ** [php-fpm] [8] Starting php-fpm 8.0.13
    2021-12-06-16:03:23 [STARTING] ** [php-fpm] [9] Starting php-fpm 8.0.13
    ...

What is the expected correct behavior?

Service started and listening on specified exposed port
...
[services.d] done.
2021-12-06-10:06:25 [STARTING] ** [nginx] [1] Starting nginx 1.21.4
2021-12-06-10:06:25 [STARTING] ** [monitoring] [1] Starting Zabbix Agent (modern) 5.4.8
2021-12-06-10:06:25 [STARTING] ** [scheduling] [1] Starting cron
2021-12-06-10:06:25 [STARTING] ** [php-fpm] [1] Starting php-fpm 8.0.13

Relevant logs and/or screenshots

Environment

tiredofit/nginx-php-fpm:latest
sha256:ff8944c683c8ab169afe00de6f6e6d4942702e8c5e1df13a7b704d19b43678d2
OS: CentOS Linux release 8.4.2105

Possible fixes

not using that variable, allows image to be working OK

After pulling latest_php8.0 docker image error in the logs

Summary

After pulling the image and restarting my docker-compose.yml i got the error;

[12-Mar-2022 20:52:36] WARNING: [pool www] child 547429 said into stderr: "NOTICE: PHP message: PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /www/html/overrides/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php on line 38" [12-Mar-2022 20:52:36] WARNING: [pool www] child 547429 said into stderr: "NOTICE: PHP message: PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 32768 bytes) in /www/html/vendor/symfony/debug/Exception/FatalErrorException.php on line 1" [12-Mar-2022 20:52:41] NOTICE: Terminating ... [12-Mar-2022 20:52:41] NOTICE: exiting, bye-bye!

Steps to reproduce

Pulling the latest_php8.0 image (?)

What is the expected correct behavior?

Not exiting the freescout instance 8D

Relevant logs and/or screenshots

Environment

  • Image version / tag: freescout:latest_8.0
  • Host OS: Ubuntu 20.04
version: '2'

services:

freescout-app:
image: tiredofit/freescout:latest_php8.0
container_name: freescout-app
links:
- freescout-db
volumes:
### If you want to perform customizations to the source and have access to it, then uncomment this line - This includes modules
#- ./data:/www/html
### Or, if you just want to use Stock Freescout and hold onto persistent files like cache and session use this, one or the other.
- ./data:/data
### If you want to just keep the original source and add additional modules uncomment this line
- ./modules:/www/html/Modules
- ./logs/:/www/logs
environment:
- CONTAINER_NAME=##
- DB_HOST=#-db
- DB_NAME=#
- DB_USER=#
- DB_PASS=#
- SITE_URL=#
- ADMIN_EMAIL=#
- ADMIN_PASS=#!
- ENABLE_SSL_PROXY=TRUE
- DISPLAY_ERRORS=FALSE
- TIMEZONE=Europe/Amsterdam
labels:
- "traefik.http.routers.freescout.rule=Host(#)"
- "traefik.http.routers.freescout.tls=true"
- "traefik.http.routers.freescout.tls.certresolver=lets-encrypt"
- "traefik.http.services.freescout.loadbalancer.server.port=80"
- "traefik.docker.network=web"
networks:
- web
- internal
restart: always

freescout-db:
image: tiredofit/mariadb
container_name: freescout-db
volumes:
- ./db:/var/lib/mysql
environment:
- ROOT_PASS=#
- DB_NAME=#
- DB_USER=#
- DB_PASS=#

  - CONTAINER_NAME=freescout-db
networks:
  - internal
restart: always
labels:
  - traefik.enable=false

networks:
web:
external: true
internal:
external: false

Possible fixes

syntax error near unexpected token 'fi'

Hi there,

I am running your docker tiredofit/freescout:latest image, I noticed the following error is recurring throughout the docker logs on startup:

[container-name]-app          | /assets/defaults/20-php-fpm: line 44: syntax error near unexpected token `fi'
[container-name]-app          | /assets/defaults/20-php-fpm: line 44: `fi'

I am posting in this repo instead of freescout as it looks like it might be referencing this line:

When I search this repo for mentions of PHP_ENABLE_REDIS, which is part of the conditional statement, I only find it in the CHANGELOG, README, and the line above from 20-php-fpm.

It looks like the issue arises from there being no default set (e.g. PHP_ENABLE_REDIS=FALSE) in /assets/defaults/20-php-fpm. Should there be one, or should I be setting that in my docker-compose.yml?

Plugins touted as enabled, yet are unconfigured

From the latest, docker-fusiondirectory image, which has 15105a8 from this repo as a base, I see this message in the logs

[cont-init.d] 20-php-fpm: executing...
[NOTICE] ** [php-fpm] PHP-FPM Preparing to start with the following plugins enabled: apcu, bcmath, ctype, curl, dom, gd, gettext, iconv, imagick, imap, intl, json, ldap, mbstring, mcrypt, mysqli, mysqlnd, opcache, openssl, pdo, pdo_mysql, pgsql, phar, session, xml, xmlreader, zlib
[cont-init.d] 20-php-fpm: exited 0.

yet the configuration files that enable these plugins are all missing

bash-4.4# cd /etc/php7/conf.d/
bash-4.4# ls -al
total 24
drwxr-xr-x    2 root     www-data         6 Apr 21 17:31 .
drwxr-xr-x    4 root     www-data         6 Apr 21 17:31 ..
-rwxr-xr-x    1 root     www-data        18 Jan 27 22:54 01_imap.ini
-rwxr-xr-x    1 root     www-data        20 Dec 25  2018 mcrypt.ini
-rwxr-xr-x    1 root     www-data        51 Apr 21 17:31 smtp.ini
-rwxr-xr-x    1 root     www-data        18 Apr 21 17:31 timezone.ini

The key clue to this puzzle is that when trying to load fusiondirectory, I'm greeted by this helpful error, which wasn't present before

Fatal error: Uncaught Error: Call to undefined function session_name() in /www/fusiondirectory/include/class_session.inc:222 Stack trace: #0 /www/fusiondirectory/html/index.php(114): session::start() #1 {main} thrown in /www/fusiondirectory/include/class_session.inc on line 222

I think the logic for deleting those files could be wrong?

Modifiy php-fpm.conf for logs which exceed the character default limit

Description of the feature

The php-fpm log is not showing because the log_limit buffer is using the default 1024 characters. When the log exceeds that limit The access log request is truncated.

Benftits of feature

Logs should contain the proper information to read.

Additional context

Solusion:
Adding log_limit in php-fpm.conf to be greater than 1024.
eg. log_limit = 2048
reference: https://www.php.net/manual/en/install.fpm.configuration.php

Supervisor for support monitoring

Description of the feature
Supervisor for support monitoring

Benftits of feature
client/server system that allows its users to monitor and control a number of processes on UNIX-like operating systems

Additional context

Enable SMTP inside ENV variables, or docker-compose configuration?

Is there anyway to enable the SMTP configuration in the docker-compose or environment variables, configuration, anything when running this docker image?

Right now I have to login to freescout after, goto settings, then configure SMTP to connect to my mail server. Looking for a SMTP_HOST, SMTP_USER, SMTP_PASSWORD, type settings. Thanks

PHP_TIMEOUT doesn't update max_execution_time in php.ini

Summary

$PHP_TIMEOUT variable only sets php_admin_value[max_execution_time] in /etc/phpXX/php-fpm.conf but does not update max_execution_time in php.ini.

Steps to reproduce

Set PHP_TIMEOUT=1200 environment variable for app container in docker compose file and fire up a new stack.

Spawn a shell in that app container and verify:

/ # grep exec /etc/php82/php-fpm.conf 
php_admin_value[max_execution_time] = 1200

/ # grep exec /etc/php*/php.ini
max_execution_time = 30

In the case of the tiredofit/freescout image, the scheduler and queue processes are executed using the php-cli binary, which relies on the settings specified in /etc/phpXX/php.ini. This works alright for smaller installations, but causes problems when using dozens of mailboxes. In that case, the fetch mail process gets interrupted with signal 15 once the timeout is reached.

# laravel.log
[...]
The process has been signaled with signal "15"

What is the expected correct behavior?

  • Image version / tag: All PHP-FPM images

Possible fixes

Setting PHP_MEMORY_LIMIT=3G does update both, php-fpm.conf and php.ini:

/ # grep -E 'memory_limit' /etc/php82/php-fpm.conf 
php_admin_value[memory_limit] = 3G

/ # grep 'memory_limit' /etc/php82/php.ini 
memory_limit = 3G

Proposing to update the PHP-FPM scripts to set max_execution_time in php.ini based on $PHP_TIMEOUT.

Temporary Workaround

As specified in issue #50 .

env variables of the app container in the compose file now contains this:

"CONTAINER_POST_INIT_COMMAND=sed -i 's|max_execution_time =.*|max_execution_time = 360|g' /etc/php*/php.ini"

which "works" ...

How to debug a 502 Bad Gateway

Hi,
i created the following docker-compose.yml file. When trying to reach example.com, i get a 502 Bad Gateway.
I cannot find anything in logs. Neither nginx or php-fpm.
Where is a good point to start debugging the issue?

version: '3.9'
services:
        nginx-php-fpm:
                image: tiredofit/nginx-php-fpm
                restart: unless-stopped
                container_name: example.com
                volumes:
                - ./html:/www/html
                - ./logs:/www/logs
                - ./nginx_conf.d:/etc/nginx/conf.d
                environment:
                - VIRTUAL_HOST=example.com
                - VIRTUAL_NETWORK=proxy_default
                - VIRTUAL_PORT=80
                # - LETSENCRYPT_HOST=example.com,www.example.com
                # - [email protected]
                - ZABBIX_HOSTNAME=example.com
                - STAGE=PRODDUCTION
                - TIMEZONE=Europe/Athens
                - ENABLE_SMTP=FALSE
                - DEBUG_PERMISSIONS=TRUE
                - ENABLE_PERMISSIONS=TRUE
                - USER_nginx=1000
                - GROUP_www-data=1000
networks:
        default:
                external:
                        name: proxy_default

tiredofit/nginx-php-fpm:5.6-latest - FPM does not start

I was depending on "latest" label on your great container, however my containers suddenly stopped working.
Observed behaviour (based on logs) - FPM starting (but never ever really starting), the requests to the container via NGINX refused (502 Bad Gateway).

I managed to identify that latest working version (changing to depend on this version restores my containers to working state), is tiredofit/nginx-php-fpm:5.6-5.3.6

Probably something with the new base Alpine image ?

XDebug not enabled in branch 5.6

As reported by phpinfo(), xdebug is not enabled, or am I doing something wrong?

services:
  wp:
    image: tiredofit/nginx-php-fpm:5.6-latest
    links:
      - db
    ports:
      - '8000:80'
    environment:
      OPCACHE_MEM_SIZE: 0
      PHP_ENABLE_XDEBUG: 'TRUE'
      PHP_XDEBUG_REMOTE_HOST: "host.docker.internal"

Enable github discussions ?

Hi Dave,

Sometimes there are usage questions that could end up reported as an issue but they could be better addressed with github discussions, just a thought.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.