This is a result of the log level on Nginx's error_log directive.
https://www.nginx.com/resources/admin-guide/logging-and-monitoring/
error_log logs/error.log warn;
messages of warn, error crit, alert, and emerg levels are logged.
The default setting of the error log works globally. To override it, place the error_log directive in the main (top-level) configuration context. Settings in the main context are always inherited by other configuration levels. The error_log directive can be also specified at the http, stream, server and location levels and overrides the setting inherited from the higher levels.
That line about buffering is at the warn level:
[warn] 30055#0: *1428 an upstream response is buffered to a temporary file
So if you ensure your error log level isn't set to warn, i.e. leave it at the default or decrease it, then you won't see that warning anymore. Either of the solutions below will suppress them:
Leave it at the default (level 'error' and above):
error_log logs/error.log;
Same thing:
error_log logs/error.log error;
You can also increase the threshold beyond error
, up to crit
, alert
, and emerg
.
Assuming that there is some need to cache local files I just went and added the following configuration to an nginx box and it seems to work fine straight out of the box:
proxy_cache_path /data/nginx/cache keys_zone=one:128m;
server {
listen 127.0.0.1:80;
server_name _;
root /usr/share/nginx/local;
location / {
autoindex on;
allow all;
satisfy any;
try_files $uri $uri/ =404;
}
}
server {
listen ipv4.addr:443 ssl http2;
listen [ipv6addr]:443 ssl http2;
server_name _;
root /usr/share/nginx/html;
include /etc/nginx/ssl.conf;
location /local/ {
allow all;
satisfy any;
proxy_cache one;
proxy_cache_key "$host$request_uri";
proxy_cache_min_uses 1;
proxy_cache_methods GET HEAD;
proxy_pass http://127.0.0.1:80/;
}
}
Best Answer
Yes, nginx can be used as reverse cache and cache files to disk. Here is example configuration: http://wiki.nginx.org/ReverseProxyCachingExample