Home  >  Article  >  Operation and Maintenance  >  How to configure nginx log access_log

How to configure nginx log access_log

WBOY
WBOYforward
2023-05-30 18:28:062514browse

The access log of the web server is very important. We can analyze the user's access through the access log.

We can also find some abnormal access, such as cc attacks, through the access log.

Format: access_log /path/to/logfile format;

access_log can be configured in the http, server, and location configuration sections.

Configuration example:

server 
{
    listen 80;
    server_name www.xxx.com;
    root /data/wwwroot/www.xxx.com;
    index index.html index.php;
    access_log /data/logs/www.xxx.com_access.log main;
}
说明:若不指定log_format,则按照默认的格式写日志,main为默认的日志格式。

The above is the detailed content of How to configure nginx log access_log. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete