Recently, when configuring the local nginx development environment, I discovered a problem. When the server segment does not specify access_log, and when no access_log parameter is specified in the http segment, it will write to the file logs/access.log by default, which is the default access_log. The value is "logs/access.log", and it is the access log of all servers. But I did not find the default value for this configuration on the nginx website.
If we don’t need it, add a line access_log off in the http segment; and then configure the logs you want to write in a specific server. In the development environment, I do not write logs by default, that is, I do not configure any access_log and only open it when needed.
In the http segment of nginx, set access log:
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 gzip '$remote_addr - $remote_user [$time_local] "$request" ' '$status $bytes_sent "$http_referer" ' '"$http_user_agent" "$gzip_ratio"'; log_format download '$remote_addr - $remote_user [$time_local] "$request" ' '$status $bytes_sent "$http_referer" "$http_user_agent" ' '"$http_range" "$sent_http_content_range"'; #access_log logs/access.log main; access_log off;
The above introduces the complete shutdown of nginx access_log, including access and nginx content. I hope it will be helpful to friends who are interested in PHP tutorials.