nginx 日志文件分为 log_format 和 access_log 两部分
log_format 定义记录的格式,其语法格式为
log_format 样式名称 样式详情
配置文件中默认有
log_format main 'remote_addr - remote_user [time_local] "request" '
'status body_bytes_sent "$http_referer" '
'"http_user_agent" "http_x_forwarded_for"';
使用 limit_rate 限制客户端传输数据的速度
1、编辑/etc/nginx/nginx.conf
location / {
root /var/www/nginx/;
index index.html index.htm;
limit_rate 2k; #对每个连接的限速为2k/s
}
修改完配置文件,需要重启服务(重新加载服务)