nginx error.log 不是目录

nginx error.log Not a directory

我正在尝试访问我的 Digital Ocean Django Droplet 的错误日志。 当我尝试将目录从 / 充电到 /var/log/nginx/error.log 时,我得到 -bash: cd: error.log: Not a directory
该文件在那里,我可以通过 Cyber​​duck 手动访问它。我想弄清楚我的 smtp 联系表有什么问题,如果我无法访问 error.log 文件,我就无法弄清楚。任何帮助都是极好的。谢谢

您不能将目录更改为文件。您将先 cd 到包含该文件的文件夹:

cd /var/log/nginx

从那里你可以只用 error.log:

vim error.log # edit/view file
tail error.log # view last lines of file
cat error.log # output contents of file to screen

然而,您也可以使用完整路径执行任何这些命令(并从任何地方执行):

vim /var/log/nginx/error.log # edit/view file
tail /var/log/nginx/error.log # view last lines of file
cat /var/log/nginx/error.log # output contents of file to screen

您收到该错误消息是因为 error.log 不是目录,而是文本文件。如果你想阅读它,你可以使用像 nano 或 vim 这样的文本编辑器,或者你的 DO droplet 中包含的任何文本编辑器。