Home > Operation and Maintenance > Nginx > Where are the nginx access logs?

Where are the nginx access logs?

(*-*)浩
Release: 2019-07-15 14:00:14
Original
10972 people have browsed it

nginx log is divided into access log and error log

Where are the nginx access logs?

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;
Copy after login

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;
Copy after login

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 :记录客户端浏览器的相关信息;
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template