Apache logs SIGWINCH and exits on its own
caught SIGWINCH, shutting down gracefullyShort answer
SIGWINCH is Apache's graceful-stop signal. The line means something asked httpd to finish current requests and exit, not that it crashed. In a Docker container the official image makes this the stop signal, so docker stop, compose down or an orchestrator sends it. On a normal server, look for a script or admin that ran graceful-stop.
Fix it fast
1Find out which cause you have
Check whether Apache runs in a container or on the host, and read the exit state. A clean stop with no error before it points to a requested shutdown, not a fault.
docker ps -a --filter name=my-apache --format '{{.Names}} {{.Status}}' sudo tail -n 20 /var/log/apache2/error.log2Match what you see, then jump to its fix
- 1
the message is the last line in docker logs, and the container stopped without any error before itDocker, compose or an orchestrator stopped the containerFix - 2
no container is involved, and the shutdown time matches a script run, a deploy or a manual commandSomeone or a script ran graceful-stop on the hostFix
- 1
What does the error look like?
caught SIGWINCH, shutting down gracefullythe httpd container stops although nothing crashed
Cause 1 of 2
Docker, compose or an orchestrator stopped the container
1Check
The official httpd image sets STOPSIGNAL SIGWINCH. Docker sends the image's configured stop signal first and only uses SIGTERM when none is set, so every normal stop reaches Apache as a graceful stop. Look for who stopped it: a docker stop, a compose down or restart, a deploy, a health check or a node drain.
docker inspect --format '{{.Config.StopSignal}}' my-apache
docker logs --tail 20 my-apache2Fix
Nothing in Apache is broken. Find the stop in your deploy or orchestration logs and, if it was not meant to happen, fix that trigger. Set a restart policy in your compose file so the container comes back after a stop you did not plan.
# in docker-compose.yml, under the service
restart: unless-stopped3Verify
Start the container again and confirm it stays up under the same workflow.
docker ps --filter name=my-apacheConfirmed by docs.docker.com
Cause 2 of 2
Someone or a script ran graceful-stop on the host
1Check
In Apache the WINCH signal and apachectl -k graceful-stop are the same thing. The parent removes its PID file, stops listening and exits once its children finish. Search your scripts, cron jobs and shell history for it.
sudo grep -R "graceful-stop\|SIGWINCH\|kill -WINCH" /etc /usr/local/bin /opt 2>/dev/null
grep -n "graceful-stop" ~/.bash_history2Fix
Replace the call with graceful (apachectl -k graceful) when you want a reload with no downtime, since that signal starts a new generation of workers instead of exiting.
sudo apachectl -k graceful3Verify
Run the changed script and check that httpd keeps running afterwards.
pgrep -a httpd || pgrep -a apache2Confirmed by httpd.apache.org
How do I stop it coming back?
- Use graceful, not graceful-stop, in deploy scripts that must keep the site online.
- Add a restart policy to containers and an uptime check that alerts when the web server is down.
- Log who runs stop commands in your deploy tooling so an unexpected shutdown can be traced.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Servers
sam local fails: Running AWS SAM projects locally requires Docker
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
sam local start-api and sam local invoke run your function inside a Docker container, so SAM stops if it cannot talk to Docker.
3 causes, each with a fixServers
dnf fails to download repo metadata in a CentOS 8 Docker build
The same Dockerfile built fine before 2022
CentOS Linux 8 reached end of life on 31 December 2021 and its content left the mirrors.
2 causes, each with a fixServers
pip install confluent-kafka fails because librdkafka/rdkafka.h is missing
pip stops while building confluent-kafka from source
The error means pip is compiling confluent-kafka from source, and the compiler cannot find the librdkafka C headers.
3 causes, each with a fixServers
Cypress says the npm package is installed but the binary is missing
Cypress binary is missing after npm install in CI or in a Docker build
The npm package is only a launcher.
3 causes, each with a fixServers
A dev container port does not open in the browser when Docker runs on a remote host
If your application only accepts calls from localhost, it will reject connections from published ports
Three things usually break it: the app listens only on localhost inside the container, so published ports are rejected; you open the container port instead of the mapped localhost port VS Code shows; or you changed appPort or a Compose ports list and did not rebuild.
3 causes, each with a fixServers
Docker build fails with apk: not found in a Python or Ubuntu image
/bin/sh: 1: apk: not found
apk is the package manager of Alpine Linux only.
2 causes, each with a fix