nginx log is divided into access log and error log
The access log (access log) records which users, which pages and user browsers , ip and other access information
access log format configuration
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"' '$upstream_addr $upstream_response_time $request_time '; access_log logs/access.log main;
Configure the storage location and file of the access log log.
Note: access.log file can be split by date for easy viewing and processing
access_log /usr/local/nginx/log/access.log main;
Related instructions
$remote_addr 与$http_x_forwarded_for 用以记录客户端的ip地址; $remote_user :用来记录客户端用户名称; $time_local : 用来记录访问时间与时区; $request : 用来记录请求的url与http协议; $status : 用来记录请求状态;成功是200, $body_bytes_s ent :记录发送给客户端文件主体内容大小; $http_referer :用来记录从那个页面链接访问过来的; $http_user_agent :记录客户端浏览器的相关信息;
For more Nginx related technical articles, please visit the Nginx Usage Tutorial column to learn!
The above is the detailed content of Where are the nginx access logs?. For more information, please follow other related articles on the PHP Chinese website!