Nginx error log (error_log) configuration and information detail
Nginx software will record the fault information of its own operation and log information of user access to the specified log file.
Nginx error log information is introduced
Nginx error message is an important means of debugging Nginx service, belongs to the core function module (NGX_core_module) parameter, the name of the parameter is error_log, can be placed in the Main block global configuration, can also be placed in a different virtual host to separate the virtual host error message
The default value of error_log:
# error_log logs/error log the error;
The syntax format and parameter syntax of error_log are described as follows:
Error_log & lt; FILE> & lt; LEVEL>;
Keyword log file error log level
Keyword: Where the keyword error_log cannot be changed
Log file: You can specify any directory where you want to store logs
Error log level: the common error log level is [debug | info | notice | warn | error | crit | alert | emerg], the higher the level is, the less information will be recorded.
The production scenario is generally one of the three levels of warn | error | crit
Note: Do not configure the lower levels of the INFO level, which can cause significant disk I/O consumption.
The tag segment location of the error_log parameter:
main, http, server, location
Reference data: http://nginx.org/en/docs/ngx_core_module.html#error_log
The Nginx configuration error logging procedure is described
(1) Insert the error_log statement
vi conf/vhost/www.abc.com.conf
# VI edit the virtual host configuration file
Document Contents:
server {
Access_log/data/log/WWW.
Listen, 80;
Server_name abc.com www.abc.com;
The location/{
The root/data/WWW/WWW.
The index index. HTML index. HTM;
}
Error_log logs/error_www.abc.com.log error;
# New content ↑
}
(2) Restart the service
After confirmation, you can restart the machine. The operation is as follows:
nginx -t
# results show that OK and Success are ok and can be restarted
nginx -s reload
(3) Check the error log file
ll logs/error_www.abc.com.log
-rw-r–r– 1 root root 2305 Jun 13 18:25 logs/error_www.abc.com.log
Check to see if the file is produced and the configuration is successful.
Read More:
- Nginx reports 502 error, log connect() failed (111: Connection refused) while connecting to upstream. A personal effective solution
- Consult IDE log for more details (Help | Show Log),read failed, socket might closed or timeout,
- @In slf4j log.info Compile error: cannot find symbol log
- About error statuslogger no log4j2 configuration file found
- ERROR StatusLogger No log4j2 configuration file found.
- ERROR StatusLogger No Log4j 2 configuration file found
- Vs_ Code remote SFTP connects to the server to modify the nginx configuration information and reports all configured authentication methods failed
- Eclipse startup error: an error has occurred.See the log file E:\workspace\.metadata\.log.
- Ubuntu18.04 x11vnc failed, report error opening logfile: /var/log/x11vnc.log
- MySQL advanced — Explanation of ref field in explain information
- An error is reported when Clickhouse is started. The error log information is: structure needs cleaning
- Nginx startup error: nginx: [error] open() “/ var / run / nginx/ nginx.pid The solution of “failed (2: no such file or directory)”
- nginx: [error] open() "/var/run/nginx/nginx.pid" failed (2: No such file or directory)
- Error occurs when configuring nginx installation information. / configure: error: the HTTP rewrite module requires the PCRE library. You can
- nginx: [error] open() “/usr/local/nginx/logs/nginx.pid“ failed (2: No such file or directory)
- Detailed explanation of yield in Python — the simplest and clearest explanation
- PHP CI (CodeIgniter) log level setting
- Ranger Solr audit log installation
- nginx: [error] invalid PID number ““ in “/data/nginx/logs/nginx.pid“