gpt4 book ai didi

web-services - Nginx 重复的 log_format 名称 timed_combined 错误

转载 作者:行者123 更新时间:2023-12-05 09:18:08 25 4
gpt4 key购买 nike

我收到这个错误:

Restarting nginx: nginx: [emerg] duplicate "log_format" name "timed_combined" in /etc/nginx/sites-enabled/default:8
nginx: configuration file /etc/nginx/nginx.conf test failed

每当我尝试启动或重新启动我的 nginx 服务器时。这在以前不会发生。这是我的 /etc/nginx/sites-enabled/default

中的前几行代码
# You may add here your
# server {
# ...
# }
# statements for each of your virtual hosts
log_format timed_combined '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" $request_time';

最佳答案

“timed_combined”log_format 是在源代码中预定义的;你需要使用你的名字,比如:

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

之后需要重新定义access_log:

access_log/path/to/access.log my_log

关于web-services - Nginx 重复的 log_format 名称 timed_combined 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45538437/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com