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

673,020

Solution 1

Errors are stored in the nginx log file. You can specify it in the root of the nginx configuration file:

error_log  /var/log/nginx/nginx_error.log  warn;

On Mac OS X with Homebrew, the log file was found by default at the following location:

/usr/local/var/log/nginx

Solution 2

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

Solution 3

Run this command, to check error logs:

tail -f /var/log/nginx/error.log

Solution 4

My ngninx logs are located here:

/usr/local/var/log/nginx/*

You can also check your nginx.conf to see if you have any directives dumping to custom log.

run nginx -t to locate your nginx.conf.

# in ngingx.conf
error_log  /usr/local/var/log/nginx/error.log;
error_log  /usr/local/var/log/nginx/error.log  notice;
error_log  /usr/local/var/log/nginx/error.log  info;

Nginx is usually set up in /usr/local or /etc/. The server could be configured to dump logs to /var/log as well.

If you have an alternate location for your nginx install and all else fails, you could use the find command to locate your file of choice.

find /usr/ -path "*/nginx/*" -type f -name '*.log', where /usr/ is the folder you wish to start searching from.

Solution 5

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
Share:
673,020
ha22109
Author by

ha22109

web developer in django python

Updated on August 01, 2022

Comments

  • ha22109
    ha22109 almost 2 years

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

  • Michael Berkowski
    Michael Berkowski over 9 years
    Apparently this is configureable only at compile time with the --error-log-path compile option trac.nginx.org/nginx/ticket/147
  • jmarceli
    jmarceli about 9 years
    That's maybe version dependent but my log is inside: /opt/nginx/logs/error.log
  • Félix Adriyel Gagnon-Grenier
    Félix Adriyel Gagnon-Grenier over 8 years
    on Mac OS X with homebrew: /usr/local/var/log/nginx. see lfender's answer
  • MarthyM
    MarthyM over 7 years
    On ubuntu I have it in /var/log/nginx/error.log. It is best to check the nginx.conf file and find the error_log setting.
  • mrun
    mrun over 6 years
    That is not an answer and should be a comment instead. Once you have sufficient reputation you will be able to comment.
  • Jan Bludau
    Jan Bludau about 6 years
    on raspberry pi3 its the location
  • Sridhar Sarnobat
    Sridhar Sarnobat almost 5 years
    The logs will be here if you installed Nginx with Homebrew.
  • Amit Verma
    Amit Verma almost 4 years
    Pls do consider of explaining your code and how it would help, so that others can be benefited from this.