解决错误 nginx: [emerg] unknown log format "main" in /usr/local/nginx/conf/nginx.conf

  • 服务器
  • 2022-05-23
  • 767 已阅读
  • 作者: 李纲明
  • 来源: CSDN
         
简介重启nginx是出现了如下错误:nginx: [emerg] unknown log format "proxy_log" in /usr/local/nginx/conf/nginx.conf:117。 解决办法:打开nginx.conf,"main"错误是因为丢失了log_format选项,之前把他屏蔽掉了,修改之后问题解决。

重启nginx是出现了如下错误:

nginx: [emerg] unknown log format "proxy_log" in /usr/local/nginx/conf/nginx.conf:117

解决办法:

打开nginx.conf,"main"错误是因为丢失了log_format选项,之前把它屏蔽掉了,修改之后问题解决。

user www www;
pid /var/log/nginx/nginx.pid;
worker_processes 8;
worker_rlimit_nofile 1024;
events {
    worker_connections     2048;
    use epoll;
}
http {
user  www;
worker_processes  2;
#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;

    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  logs/access.log  main;
}

很赞哦! ( 0 )