After upgrading the Nginx to the 1.2.4 stable version, you will find that the log configuration in the previous vhost/*.conf has been reported as follows warn:
Copy Code code as follows:
Nginx: [Warn] the "log_format" directive May is used only in "HTTP" level
The Internet search solution is as follows:
Move the following code from the server section in the/vhost/xxx.conf to the server segment.
But this will create a problem, that is, each child domain name log files will record all the requested log, and so long did not find a solution, and then asked the flying after finally found a way to solve.
Originally Log_format need to define in the HTTP layer of nginx.conf, then do not define Log_format under the domain name, direct reference can be, namely:
In nginx.conf, add the HTTP layer:
Copy Code code as follows:
Log_format Main ' $remote _addr– $remote _user [$time _local] ' $request '
' $status $body _bytes_sent ' $http _referer '
' $http _user_agent ' $http _x_forwarded_for $request _time ';
Then write directly in the server in vhost/*.conf:
Copy Code code as follows:
Access_log./logs/blog.log Main;
But note that include vhost/*.conf should be placed after Log_format Oh, or you will not find the main