我使用Django与FastCGI + nginx。在这种情况下,日志(错误)存储在哪里?
当前回答
cd /var/log/nginx/
cat error.log
其他回答
对于Mac OS用户,可以在终端中输入nginx -help。
nginx version: nginx/1.21.0
Usage: nginx [-?hvVtTq] [-s signal] [-p prefix]
[-e filename] [-c filename] [-g directives]
Options:
-?,-h : this help
-v : show version and exit
-V : show version and configure options then exit
-t : test configuration and exit
-T : test configuration, dump it and exit
-q : suppress non-error messages during configuration testing
-s signal : send signal to a master process: stop, quit, reopen, reload
-p prefix : set prefix path (default: /opt/homebrew/Cellar/nginx/1.21.0/)
-e filename : set error log file (default: /opt/homebrew/var/log/nginx/error.log)
-c filename : set configuration file (default: /opt/homebrew/etc/nginx/nginx.conf)
-g directives : set global directives out of configuration file
然后,您可以为配置和日志文件找到一些默认路径,在这种情况下:
/opt/homebrew/log/nginx/error.log
在nginx配置文件中设置访问日志的位置是一个很好的实践。使用acces_log /path/如下所示。
keyval $remote_addr:$http_user_agent $seen zone=clients;
server { listen 443 ssl;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
if ($seen = "") {
set $seen 1;
set $logme 1;
}
access_log /tmp/sslparams.log sslparams if=$logme;
error_log /pathtolog/error.log;
# ...
}
我在/usr/local/nginx/logs/*目录中找到了它。
Linux服务器上的日志位置:
Apache – /var/log/httpd/
IIS – C:\inetpub\wwwroot\
Node.js – /var/log/nodejs/
nginx – /var/log/nginx/
Passenger – /var/app/support/logs/
Puma – /var/log/puma/
Python – /opt/python/log/
Tomcat – /var/log/tomcat8
在终端输入以下命令:
sudo cat /var/log/nginx/error.log
推荐文章
- 如何在django应用程序中显示favicon ?
- 如何在Django中设置时区
- Nginx提供下载。php文件,而不是执行它们
- django导入错误-没有core.management模块
- 如何从外部访问本地Django web服务器
- NGINX 499错误码的可能原因
- 在Django模型中存储电话号码的最佳方法是什么?
- 如何禁用django-rest-framework的管理风格的可浏览界面?
- 如何获取请求。Django-Rest-Framework序列化器中的用户?
- NGINX:从上游读取响应报头时超时(110:连接超时)
- 如何在Django模板中获得我的网站的域名?
- 在django Forms中定义css类
- 我应该在.gitignore文件中添加Django迁移文件吗?
- SQLAlchemy是否有与Django的get_or_create等价的函数?
- 如何选择一个记录和更新它,与一个单一的查询集在Django?