Mastering Nginx

(Ron) #1
Chapter 4

[ 69 ]

Directive Explanation
proxy_send_timeout The length of time that needs to elapse
between two successive write operations
to an upstream server, before the
connection is closed.
proxy_set_body The body of a request sent to an
upstream server may be altered by
setting this directive.
proxy_set_header Rewrites the contents of headers sent to
an upstream server; may also be used to
not send certain headers by setting its
value to the empty string.
proxy_temp_file_write_size Limits the amount of data buffered to
a temporary file at one time, so that
NGINX will not block too long on a
single request.
proxy_temp_path A directory where temporary files
may be buffered as they are proxied
from the upstream server, optionally
multi-level deep.

The following listing brings many of these directives together in a file that can be


included in the configuration within the same location as the proxy_pass directive.


Contents of proxy.conf:


proxy_redirect off;

proxy_set_header Host $host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

client_max_body_size 10m;

client_body_buffer_size 128k;
Free download pdf