使用 tail -f 命令实时查看 Nginx 的最新日志,可以利用软链接技巧,将日志文件指向 /dev/stdout。具体操作如下:

tail -f /dev/stdout

这个命令会实时显示 /var/log/nginx/access.log 文件的内容。因为 /var/log/nginx/access.log 是一个软链接,指向了 /dev/stdout,所以实际上就是查看 /dev/stdout 的内容,即 Nginx 的最新日志。

如何使用 tail -f 实时查看 Nginx 日志 (软链接技巧)

原文地址: https://www.cveoy.top/t/topic/qyPn 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录