This article is a mirror article of machine translation, please click here to jump to the original article.

View: 15371|Reply: 0

[Web] Detailed explanation of Nginx configuration logs

[Copy link]
Posted on 2020-4-10 16:03:15 | | |
Nginx is an asynchronous framework web server that can also be used as a reverse proxy, load balancer and HTTP caching.

Look at the configuration file that the nginx actually calls

1. Check the nginx path

The path to nginx is: /soft/nginx/sbin/nginx

2. View the nginx configuration file path
Use the -t parameter of nginx to perform a configuration check to know the actual file path and whether the call is valid.

It can be seen that the configuration file path of nginx is: /soft/nginx/nginx.conf and the call is valid.

nginx.conf log configuration

There are two main parameter controls for Nginx access logs

  • log_format ---- is used to define the format of the log logs (multiple log formats can be defined, just take different names)
  • access_log ----- is used to specify the path to the file and what log format is used to record the log


Default values for log_format:

log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                     '"$http_user_agent" "$http_x_forwarded_for"';
Default values for access_log:

access_log  logs/access.log  main;
log_format syntax format and parameter syntax are described as follows:


access_log syntax format and parameter syntax are described as follows:


Detailed explanation of Nginx built-in variables and log format variable parameters

When the value recorded in the log file is "-", it is indicated as empty.





Previous:The grammar difference between at, in, on, with, and, for in English
Next:Assemble experimental questions
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com