There is a very strange problem today: no matter what format the log format is open in nginx.conf, the www.conf is not known in the log format. Specific as follows: nginx.conf
Include vhost/*.conf;
Log_format Main ' $remote _addr-$remote _user [$time _local] '
"$request" $status $body _bytes_sent "$http _referer"
' "$http _user_agent" "$http _x_forwarded_for";
Log_format access ' $http _x_forwarded_for-$remote _user [$time _local] "$request"
' $status $body _bytes_sent ' $http _referer '
' $http _user_agent ';
The log in the nginx.conf file can use the Main,access log format, but the Conf file under Vhost cannot be used, regardless of format: www.conf
Plus log format:
access_log /www/logs/sunrise.r.xiujj.cn.log access;
You will be prompted during the test:
nginx: [emerg] unknown log format "access" in /etc/nginx/conf/vhost/www.conf:3
nginx: configuration file /etc/nginx/conf/nginx.conf test failed
Baidu, Google all times all is Log_format did not open the reason.
Later submitted work orders on Ali, Ali The engineer said it was because the above include vhost/*.conf, and then configure the log format.
load configuration is loaded from the top order, loading the Conf has not yet loaded into the log format, so it is no matter what format is:
nginx: [Emerg] Unknown log format
Put the include on the last side ...
Record it. Are not careful ... Pay attention later.
This article is from the "Davin" blog, make sure to keep this source http://ydw1118.blog.51cto.com/3035216/1669382
Nginx unknow log_format access in www.conf workaround