【发布时间】:2016-08-05 20:19:11
【问题描述】:
我正在尝试找到一种方法来关闭我的 NGINX 网络服务器中 favicon.ico 和 robots.txt 的日志记录,该服务器通过以下方式为 Flask (Python) 应用程序提供动力uWSGI。
所以,我的 nginx 配置的第一部分是:
location / {
try_files $uri @app;
}
location @app {
include uwsgi_params;
uwsgi_pass unix:/srv/www/uwsgi.sock;
}
现在,当我添加时(在上面显示的代码块上方)
location = /favicon.ico {
access_log off;
log_not_found off;
}
location = /robots.txt {
access_log off;
log_not_found off;
}
当我访问这些 URI 时,我得到 404 not found 错误。现在,当我删除 location = /... 中的 = 符号时,URI 确实有效,并且我看到了 favicon 和 robots 文件。但由于某种原因,它仍然会访问这些请求的日志。
这里似乎发生了什么?
【问题讨论】: