[GH-ISSUE #312] 2.0 beta.17 容器中的 access.log 没有指向 /dev/stdout,这与文档描述不符 #3276

Closed
opened 2026-02-28 11:55:20 +03:00 by kerem · 12 comments
Owner

Originally created by @jearton on GitHub (Feb 20, 2024).
Original GitHub issue: https://github.com/0xJacky/nginx-ui/issues/312

Describe the bug

容器中的 access.log 和 error.log,按照文档里描述的,应该是一个符号链接文件,但现在却是真实文件。

To Reproduce
Steps to reproduce the behavior:

docker exec -it nginx-ui bash
cd /var/log/nginx/
ls -la

Expected behavior

应该指向标准输出流吧

Screenshots

image

image

Info (please complete the following information):

  • Server OS: Ubuntu 22.04
  • Server Arch: x86
  • Nginx UI Version: 2.0 beta.17
  • Your Browser: Chrome
Originally created by @jearton on GitHub (Feb 20, 2024). Original GitHub issue: https://github.com/0xJacky/nginx-ui/issues/312 **Describe the bug** 容器中的 access.log 和 error.log,按照文档里描述的,应该是一个符号链接文件,但现在却是真实文件。 **To Reproduce** Steps to reproduce the behavior: ```bash docker exec -it nginx-ui bash cd /var/log/nginx/ ls -la ``` **Expected behavior** 应该指向标准输出流吧 **Screenshots** ![image](https://github.com/0xJacky/nginx-ui/assets/10370433/2d6052e1-c9c6-44a8-ba30-22e6cf30f1cc) ![image](https://github.com/0xJacky/nginx-ui/assets/10370433/0b7b9d53-c59f-4804-ab16-0621382b96cf) **Info (please complete the following information):** - Server OS: Ubuntu 22.04 - Server Arch: x86 - Nginx UI Version: 2.0 beta.17 - Your Browser: Chrome
kerem 2026-02-28 11:55:20 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@0xJacky commented on GitHub (Feb 20, 2024):

你本地原来是不是有 access.log 了
image

<!-- gh-comment-id:1953665352 --> @0xJacky commented on GitHub (Feb 20, 2024): 你本地原来是不是有 access.log 了 <img width="567" alt="image" src="https://github.com/0xJacky/nginx-ui/assets/13096985/048be091-c0f1-42a2-8435-f75c508364dd">
Author
Owner

@jearton commented on GitHub (Feb 20, 2024):

@0xJacky 你用的是 beta.17 验证的吗?

docker run --rm \
        -e TZ=Asia/Shanghai \
        -v ~/test/nginx/ui:/etc/nginx-ui \
        -v ~/test/nginx/log:/var/log/nginx \
        uozi/nginx-ui:latest

image

<!-- gh-comment-id:1953692173 --> @jearton commented on GitHub (Feb 20, 2024): @0xJacky 你用的是 beta.17 验证的吗? ```bash docker run --rm \ -e TZ=Asia/Shanghai \ -v ~/test/nginx/ui:/etc/nginx-ui \ -v ~/test/nginx/log:/var/log/nginx \ uozi/nginx-ui:latest ``` ![image](https://github.com/0xJacky/nginx-ui/assets/10370433/20133479-13be-4d06-a9db-4b625ff0a9b6)
Author
Owner

@jearton commented on GitHub (Feb 20, 2024):

宿主机上的 ~/test/nginx/log 目录是空的

<!-- gh-comment-id:1953693278 --> @jearton commented on GitHub (Feb 20, 2024): 宿主机上的 ~/test/nginx/log 目录是空的
Author
Owner

@jearton commented on GitHub (Feb 20, 2024):

好吧,我知道了,把 -v ~/test/nginx/log:/var/log/nginx 去掉就对了,日志文件一旦持久化到宿主机上,这个符号链接就失效了

<!-- gh-comment-id:1953697631 --> @jearton commented on GitHub (Feb 20, 2024): 好吧,我知道了,把 -v ~/test/nginx/log:/var/log/nginx 去掉就对了,日志文件一旦持久化到宿主机上,这个符号链接就失效了
Author
Owner

@0xJacky commented on GitHub (Feb 20, 2024):

是啊。。

<!-- gh-comment-id:1953697799 --> @0xJacky commented on GitHub (Feb 20, 2024): 是啊。。
Author
Owner

@jearton commented on GitHub (Feb 20, 2024):

那以后每次升级镜像,容器需要销毁重新创建,这样历史日志就没有了

<!-- gh-comment-id:1953699589 --> @jearton commented on GitHub (Feb 20, 2024): 那以后每次升级镜像,容器需要销毁重新创建,这样历史日志就没有了
Author
Owner

@0xJacky commented on GitHub (Feb 20, 2024):

那以后每次升级镜像,容器需要销毁重新创建,这样历史日志就没有了

单独映射 .local 文件到宿主机,就不要映射整个文件夹了吧,这个好像没有更好的解决办法

<!-- gh-comment-id:1953702621 --> @0xJacky commented on GitHub (Feb 20, 2024): > 那以后每次升级镜像,容器需要销毁重新创建,这样历史日志就没有了 单独映射 .local 文件到宿主机,就不要映射整个文件夹了吧,这个好像没有更好的解决办法
Author
Owner

@0xJacky commented on GitHub (Feb 20, 2024):

或者放弃打印日志到控制台,这个我没改,官方的 nginx 镜像就是这样的,直接打印到控制台

<!-- gh-comment-id:1953705157 --> @0xJacky commented on GitHub (Feb 20, 2024): 或者放弃打印日志到控制台,这个我没改,官方的 nginx 镜像就是这样的,直接打印到控制台
Author
Owner

@jearton commented on GitHub (Feb 20, 2024):

我有办法了,改变一下路径就可以了:-v ~/test/nginx/log:/var/log/nginx/local

然后把真实日志文件都存在这个子目录下面

<!-- gh-comment-id:1953713641 --> @jearton commented on GitHub (Feb 20, 2024): 我有办法了,改变一下路径就可以了:-v ~/test/nginx/log:/var/log/nginx/local 然后把真实日志文件都存在这个子目录下面
Author
Owner

@0xJacky commented on GitHub (Feb 20, 2024):

嗯,后面我更一下文档

<!-- gh-comment-id:1953715268 --> @0xJacky commented on GitHub (Feb 20, 2024): 嗯,后面我更一下文档
Author
Owner

@jearton commented on GitHub (Feb 20, 2024):

用这个方式验证了一下,没问题。对应的 logrotate 配置也要注意下。

image

<!-- gh-comment-id:1953755230 --> @jearton commented on GitHub (Feb 20, 2024): 用这个方式验证了一下,没问题。对应的 logrotate 配置也要注意下。 ![image](https://github.com/0xJacky/nginx-ui/assets/10370433/bb858c65-d893-4b57-a903-01a2b63e06d2)
Author
Owner

@0xJacky commented on GitHub (Feb 20, 2024):

是的

<!-- gh-comment-id:1953763154 --> @0xJacky commented on GitHub (Feb 20, 2024): 是的
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nginx-ui#3276
No description provided.