TrafeX / docker-php-nginx

Docker image with PHP-FPM 8.3 & Nginx 1.26 on Alpine Linux
https://hub.docker.com/r/trafex/php-nginx
MIT License
1.37k stars 736 forks source link

Containers remain in unhealthy state and cannot work after upgrade #119

Closed PikuZheng closed 1 year ago

PikuZheng commented 1 year ago

Since it is automatically upgraded by watchtower, the service stops after the upgrade, and the web page shows that the connection is refused. Log has no valid information. Restarting the container doesn't work. How can I troubleshoot?

2023-01-07 10:57:36,374 INFO supervisord started with pid 1
2023-01-07 10:57:37,379 INFO spawned: 'nginx' with pid 7
2023-01-07 10:57:37,384 INFO spawned: 'php-fpm' with pid 8
[07-Jan-2023 10:57:37] NOTICE: fpm is running, pid 8
[07-Jan-2023 10:57:37] NOTICE: ready to handle connections
2023-01-07 10:57:38,460 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2023-01-07 10:57:38,460 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
PikuZheng commented 1 year ago

Since the configuration documentation instructs us to map the configuration folder outside the container:

In config/ you'll find the default configuration files for Nginx, PHP and PHP-FPM. If you want to extend or customize that you can do so by mounting a configuration file in the correct folder;

Nginx configuration:

docker run -v "`pwd`/nginx-server.conf:/etc/nginx/conf.d/server.conf" trafex/php-nginx

Default configuration files lost after upgrade https://github.com/TrafeX/docker-php-nginx/commit/bf2732f0cf25d531578c3d56ac56117ce0031fcb . I think necessary adjustments or clarifications are needed here.

TrafeX commented 1 year ago

Hi @PikuZheng,

The default config is not lost when you mount it like described in the README because that only mounts a specific file in the conf.d folder of nginx. But when you mount the whole conf.d folder (e.g. docker run -v /my/conf.d:/etc/nginx/conf.d ..) it indeed will be lost. Is that how you run the container? Are you able to change that to only the specific files?

PikuZheng commented 1 year ago

My bad. thank you for your reply. Due to the need to map multiple files including ssl certificates and since it changes often, I mapped the entire folder. I was annoyed when I found out that it didn't work after auto-update. I added it to my config file after I found out that only the default configured listening port was not working. All functions are currently working fine.