小智 448
错误存储在nginx日志文件中.你可以在nginx配置文件的根目录中指定它.
error_log /var/log/nginx/nginx_error.log warn;
Run Code Online (Sandbox Code Playgroud)
Ben*_*Ben 293
我正在寻找一个不同的解决方案.
在我的系统(x86 Arch)上设置任何配置之前,默认情况下,错误日志位于:
/var/log/nginx/error.log
Run Code Online (Sandbox Code Playgroud)
omo*_*ser 155
lsof在大多数情况下,您可以使用(打开文件列表)查找打开的日志文件,而无需了解配置.
例:
找到httpd的PID(相同的概念适用于nginx和其他程序):
$ ps aux | grep httpd
...
root 17970 0.0 0.3 495964 64388 ? Ssl Oct29 3:45 /usr/sbin/httpd
...
Run Code Online (Sandbox Code Playgroud)
然后使用lsofPID 搜索打开的日志文件:
$ 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
Run Code Online (Sandbox Code Playgroud)
如果lsof没有打印,即使您希望找到日志文件,也可以使用发出相同的命令sudo.
你可以在这里阅读更多内容.
Tai*_*aiz 88
运行此命令,检查错误日志:
tail -f /var/log/nginx/error.log
Run Code Online (Sandbox Code Playgroud)
lfe*_*445 39
我的ngninx日志位于:
/usr/local/var/log/nginx/*
Run Code Online (Sandbox Code Playgroud)
您还可以检查您nginx.conf是否有任何指令转储到自定义日志.
跑去nginx -t找你的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;
Run Code Online (Sandbox Code Playgroud)
Nginx通常设置在/usr/local或/etc/.服务器也可以配置为转储日志/var/log.
如果您有nginx安装的备用位置且所有其他方法都失败,您可以使用该find命令找到您选择的文件.
find /usr/ -path "*/nginx/*" -type f -name '*.log',/usr/您要开始搜索的文件夹在哪里.
min*_*lyu 11
对于Mac OSnginx -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
Run Code Online (Sandbox Code Playgroud)
然后,您可以找到配置和日志文件的一些默认路径,在本例中:
/opt/homebrew/log/nginx/error.log
Run Code Online (Sandbox Code Playgroud)
记录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
Run Code Online (Sandbox Code Playgroud)
小智 5
在终端中键入此命令:
sudo cat /var/log/nginx/error.log
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
543994 次 |
| 最近记录: |