vi /nginx/conf/nginx.conf找到http{ }模塊中的 log_format去掉注釋,或是log_format寫到了別處。
解決方法:
將log_format 寫到http開頭
1
2
3
4
5
6
7
8
|
http
{
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /opt/logs/nginx/access.log main;
|