Where can I find the error logs of nginx, using fastcgi and django

Where can I find the error logs of nginx, using fastcgi and django

I'm using django with fastcgi + nginx. I want to know where the logs (error) are stored in this case

Solutions/Answers:

Answer 1:

errors are stored in nginx log file. you can specify it in root of nginx config file.

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

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

/usr/local/var/log/nginx

Answer 2:

I was looking for a different solution.

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

/var/log/nginx/error.log

Answer 3:

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 (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.

Answer 4:

Run this command, to check error logs:

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

Answer 5:

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.

Answer 6:

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

Answer 7:

cd /var/log/nginx/
cat error.log

Answer 8:

type this command in the terminal

sudo cat /var/log/nginx/error.log

Answer 9:

Found it here /usr/local/nginx/logs/*

Answer 10:

In addition, In some case nginx configure by other person and probably change the log file path which you don’t have permission to open. In that case some of above case not work,

So this fundamental is not proper but work for all case,

Open command link and type

nginx

and press enter it define details which contain path of your log file.

References