Where can I find the error logs of nginx, using FastCGI and Django?

后端 未结 9 1148
慢半拍i
慢半拍i 2020-11-30 16:02

I\'m using Django with FastCGI + nginx. Where are the logs (errors) stored in this case?

相关标签:
9条回答
  • 2020-11-30 16:37

    Run this command, to check error logs:

    tail -f /var/log/nginx/error.log
    
    0 讨论(0)
  • 2020-11-30 16:41

    You can use lsof (list of open files) in most cases to find open log files without knowing the configuration.

    Example:

    Find the PID of httpd (the same concept applies for nginx and other programs):

    $ ps aux | grep httpd
    ...
    root     17970  0.0  0.3 495964 64388 ?        Ssl  Oct29   3:45 /usr/sbin/httpd
    ...
    

    Then search for open log files using lsof with the PID:

    $ lsof -p 17970 | grep log
    httpd   17970 root    2w   REG             253,15     2278      6723 /var/log/httpd/error_log
    httpd   17970 root   12w   REG             253,15        0      1387 /var/log/httpd/access_log
    

    If lsof prints nothing, even though you expected the log files to be found, issue the same command using sudo.

    You can read a little more here.

    0 讨论(0)
  • 2020-11-30 16:45

    I found it in /usr/local/nginx/logs/*.

    0 讨论(0)
  • 2020-11-30 16:49
    cd /var/log/nginx/
    cat error.log
    
    0 讨论(0)
  • 2020-11-30 16:51

    Logs location on Linux servers:

    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
    
    0 讨论(0)
  • 2020-11-30 16:53

    I was looking for a different solution.

    Error logs, by default, before any configuration is set, on my system (x86 Arch Linux), was found in:

    /var/log/nginx/error.log
    
    0 讨论(0)
提交回复
热议问题