Nginx配置规则错误:unknown log format "main"

时间:2022-10-12 10:23:56

网站配置由apche换成nginx系统后,重启时出现错误提示

Nginx配置规则错误:

nginx: [emerg] unknown log format "main" in /www/server/panel/vhost/nginx/www.caishui1688.com.conf:97

nginx: configuration file /www/server/nginx/conf/nginx.conf test failed

解决办法

打开nginx.conf,"main"错误是因为丢失了log_format选项,因为之前做过CDN获取真实IP,后来这个删除了,将log_format添加上去后问题解决


log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                  '$status $body_bytes_sent "$http_referer" '
                  '"$http_user_agent" "$http_x_forwarded_for"';

在这里插入图片描述

猜你喜欢

版权所有:2019-2021 无双建设   网站地图