Skip to content
This repository was archived by the owner on Oct 8, 2025. It is now read-only.
This repository was archived by the owner on Oct 8, 2025. It is now read-only.

nginx unit php server stops responding when using supervisor #1309

@kapyaar

Description

@kapyaar

I have an nginx Unit+Php container with the following docker file

FROM unit:1.32.1-php8.2
RUN apt-get update && apt-get install -y supervisor
EXPOSE 80
WORKDIR /var/www/html/
COPY config.json /docker-entrypoint.d/config.json

And If I run this, it works fine, index.php loads correctly. Now, I want to use supervisor to start a php script to run as daemon. This is a kafkaConsumer with a while loop. Below are the files

[supervisord]
nodaemon=true

[program:nginx-unit]
command=unitd --no-daemon
stdout_logfile_maxbytes = 0
stderr_logfile_maxbytes = 0
stdout_logfile=/var/log/unit.log
stderr_logfile=/var/log/unit.log
autostart=true
autorestart=true


[program:kafkaTestConsumer]
command=php /var/www/html/PhpScriptThatRunsContinuously.php
autostart=true
directory=/var/www/html/
autorestart=true
stdout_logfile=/dev/stdout
stderr_logfile=/dev/stderr
stdout_maxbytes=0 # need these lines due to [https://github.com/Supervisor/supervisor/issues/935][1]
stderr_maxbytes=0
stdout_logfile_maxbytes = 0
stderr_logfile_maxbytes = 0

And a simple php script for testing.

<?php
while(1){
	sleep(3);
	echo ".";
}
?>

However, If I add the following line to Dockerfile to start supervisor,

CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]

Then, the daemon php script does start, but the php server (http://localhost/) stops responding, with the following message

localhost didn’t send any data.
ERR_EMPTY_RESPONSE

Any help much appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions