一定要按日期存储日志,不然日志文件会很大!!!!!
1.cd /usr/local/nginx/conf //进入配置文件夹
2.编辑nginx.conf
在http下添加map{}和access_log
http { include mime.types; default_type application/octet-stream; map $time_iso8601 $logdate { '~^(?<ymd>\d{4}-\d{2}-\d{2})' $ymd; default 'date-not-found'; } access_log logs/access-$logdate.log;
3.cd /usr/local/nginx/sbin
执行命令:
./nginx -s reload