title: What is the difference between proxy_buffer and fastcgi_buffer?
body: <p>I inherited an nginx config and I'm trying to optimise it for security, speed, and/or maintainability by removing rules/directives which are superfluous or not doing anything.</p>
  
  <p>With this in mind, inside my <code>server {...}</code> directive, I have:</p>
  
  <pre><code>fastcgi_buffer_size 16k;
  fastcgi_buffers 256 32k;
  </code></pre>
  
  <p>and nested within, I have individual rules for <code>locations {...}</code>, which have things like:</p>
  
  <pre><code>location ~ /(my|path)/ {
      proxy_buffer_size 4k;
      proxy_buffers     256 4k;
      ...
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>location ~ \.php$ {
      include fastcgi_params;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      fastcgi_pass unix:/dev/shm/php-fastcgi.socket;
      fastcgi_index index.php;
      ...
  }
  </code></pre>
  
  <p>Behind <em>nginx</em> we have <em>php-fpm</em> with the socket described above, but we don't proxy any other http servers (no tomcat, apache, etc).</p>
  
  <p>From my understanding, the <code>proxy_buffers</code> directives apply when you're proxying an http service such as apache, tomcat, or a third party website and would <strong>not</strong> be applicable to <em>php-fpm</em> with <em>fastcgi</em>. </p>
  
  <p>And conversely, <code>fastcgi_buffers</code> is used when you <strong>are</strong> proxying a dynamic language engine (or whatever they're called) such as <em>php-fpm</em>, <em>unicorn</em>, or <em>passenger</em>. </p>
  
  <p>Am I correct in these assumptions? And if this is the case, as I'm <strong>not</strong> using anything like apache or tomcat, then I could remove the <code>proxy_buffer*</code> directives as they're not being utilised?</p>