我有一个我想启用的log_formatconfiguration。 问题是我们的安装在nginx目录中添加了一个文件到sites-enabled(或者conf.d),我们不会碰nginx.conf本身
我想保持这种方式(更容易升级nginx版本等)
根据我的理解, log_format只能在nginx.conf中的http部分完成
我有什么select?
我知道这个迟到了,但你可以把log_format放在你的服务器范围之外。
log_format test '$remote_addr - $remote_user [$time_local] $request_time "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" "$http_x_forwarded_for"'; server { listen 80; access_log /var/log/nginx/access-test.log test; }