proxy_buffer_size 256k;
That size is huge and won't do you good. You can read the guide on how to tune it properly with one important note: fastcg_buffer_size
and proxy_buffer_size
are essentially the same thing, they are just applied to different upstream modulemodules of NGINX.
proxy_buffer_size
is the buffer for header of HTTP response of NGINX's proxy modulefastcgi_buffer_size
is the buffer for header of HTTP response of NGINX's fastcgi module
Because it is a header, it makes little sense to put things like 256k for that buffer because even a complete page HTML will hardly reach that size.
When you enable Varnish, Magento code will indeed output more HTTP headers, specifically X-Magento-Tags
may be very large depending on catalog size and if looking at a category page.
For this you need to adjust both proxy_buffer_size
and fastcgi_buffer_size
.
Why is because in your setup NGINX uses both modules: it proxies requests to Varnish (TLS termination), and does FastCGI communication to PHP-FPM.
So aside from tuning proxy_buffer_size
, you need to do the same for fastcgi_buffer_size
and tune it up as needed.
You can either do this alongside fastcgi_
directives in /var/www/example.com/html/nginx.conf.sample
or add this globally, e.g. /etc/nginx/conf.d/custom.conf
and make sure it is loaded from nginx.conf
.
Don't forget to tune *_busy_buffers_size
as well as per the guide.
E.g.:
fastcgi_buffer_size 16k;
fastcgi_busy_buffers_size 16k;