nginx 日志之 access_log

web服务器的访问日志是非常重要的,我们可以通过访问日志来分析用户的访问情况,

也可以通过访问日志发现一些异常访问,比如cc攻击。

  格式: access_log /path/to/logfile format;

access_log可以配置到http, server, location配置段中。

配置示例:

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为默认的日志格式。

猜你喜欢

转载自www.cnblogs.com/yyxianren/p/10842982.html