nginx: [emerg] unknown log format "access" in 错误解决方法

 
执行 nginx -t 出现:
 
nginx: [emerg] unknown log format "access" in /usr/local/nginx/conf/vhost/a.conf:4

配置文件内容如下:
 
access_log /data/logs/a.com_access.log access;
error_log /data/logs/a.com_error.log warn;

出现问题原因:
 
没有设置 log_format
 
解决办法:
Nginx配置文件中添加以下代码:
 
 log_format  access  '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for "$upstream_addr" "$upstream_response_time" $request_time $content_length';

0 个评论

要回复文章请先登录注册