访问日志(access_log)
需要设置 format:
access_log /var/log/nginx/access.log main;log_format main '$remote_addr - $remote_user [$time_local] "$request" ''$status $body_bytes_sent "$http_referer" ''"$http_user_agent" "$http_x_forwarded_for"';
错误日志(error_log)
需要设置 级别:
error_log /var/log/nginx/error.log warn;
级别按严重程度分:debug,info,notice,warn,error,crit,alert和 emerg,只有等于或高于此级别才会写入错误日志中。
日志切割
https://wsgzao.github.io/post/logrotate/
https://wiki.threatbook-inc.cn/pages/viewpage.action?pageId=7637018
