nginx的日志:
日志类型:
access.log 访问日志、查看统计用户的访问信息,流量。
error.log 错误日志,错误信息,重写信息。

access.log日志文件内容示例:
192.168.17.1 - - [06/Sep/2023:20:37:39 +0800] "GET /content-search.xml HTTP/1.1" 200 220 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36"


访问日志,可以统计分析用户的流量的相关情况。客情分析。
错误日志:
记录启动和运行过程中的一些错误信息。
# 定义开启错误日志 日志位置 日志级别
#error_log logs/error.log; 默认即可。
#error_log logs/error.log notice;
#error_log logs/error.log info;


如果nginx出现了错误,我们到这里面看看错误信息就可以了。
日志切割:
基于日志域名进行分割:
#定义日志格式 定义http里
log_format mylogs '$remote_addr - remote_user \[time_local] "$request" '
'$status body_bytes_sent "http_referer" '
'"http_user_agent" "http_x_forwarded_for"';