unknown log format "main" in /nginx/conf/nginx.conf

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;
原文地址:https://www.cnblogs.com/wajika/p/6514447.html