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

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

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

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

 

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄