首页 > 解决方案 > Nginx 容器无法启动 - 在“启动工作进程”时挂起

问题描述

由于某种我无法理解的原因,我的 nginx 容器在尝试启动时开始失败。它只是在几个start worker process日志条目后挂起,我在下面包含了输出:

Generating /apps/nginx/upstreams.conf...done.
Generating /apps/nginx/locations.conf...done.
Creating NGINX listener certificate...

Successfully generated /apps/nginx/resolver.conf: resolver 192.168.65.5;
Generating /apps/nginx/listen.conf...done.
Starting Nginx...
Generating /apps/nginx/upstreams.conf...done.
Generating /apps/nginx/locations.conf...done.
Creating NGINX listener certificate...
Successfully generated /apps/nginx/resolver.conf: resolver 192.168.65.5;
Generating /apps/nginx/listen.conf...done.
Starting Nginx...


Generating a RSA private key
....................................................+++++
.....................................................................................................+++++
writing new private key to '/apps/nginx/nginx-key.pem'
-----
Generating a RSA private key
........+++++
.................................................................+++++
writing new private key to '/apps/nginx/nginx-key.pem'
-----
2021/10/04 17:39:16 [notice] 1#1: using the "epoll" event method
2021/10/04 17:39:16 [notice] 1#1: nginx/1.20.1
2021/10/04 17:39:16 [notice] 1#1: built by gcc 9.3.0 (Ubuntu 9.3.0-10ubuntu2)
2021/10/04 17:39:16 [notice] 1#1: OS: Linux 5.10.25-linuxkit
2021/10/04 17:39:16 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2021/10/04 17:39:16 [notice] 1#1: start worker processes
2021/10/04 17:39:16 [notice] 1#1: start worker process 20
2021/10/04 17:39:16 [notice] 1#1: start worker process 21
2021/10/04 17:39:16 [notice] 1#1: start worker process 22
2021/10/04 17:39:16 [notice] 1#1: start worker process 23
2021/10/04 17:39:16 [notice] 1#1: start worker process 24
2021/10/04 17:39:16 [notice] 1#1: start worker process 25

此外,根本没有错误日志/var/log/nginx/error.log

这没什么好说的,但我不确定还有哪些其他细节可能有助于分享。我只是想知道是否有人以前在 docker 容器内的 nginx 实例中看到过这样的错误消息?

标签: dockernginx

解决方案


我有同样的问题。这对我有用:

docker-compose build --no-cache nginx

推荐阅读