Mastering Nginx

(Ron) #1
Chapter 6

[ 127 ]

Directive Explanation
ignore_invalid_headers Disables ignoring headers with invalid names
(default is on). A valid name is composed
of ASCII letters, numbers, the hyphen, and
possibly the underscore (controlled by the
underscores_in_headers directive).
merge_slashes Disables the removal of multiple slashes.
The default value of on means that NGINX
will compress two or more / characters into
one.
recursive_error_pages Enables doing more than one redirect using
the error_page directive (default is off).
types Sets up a map of MIME types to file name
extensions. NGINX ships with a conf/mime.
types file that contains most MIME type
mappings. Using include to load this file
should be sufficient for most purposes.
underscores_in_headers Enables the use of the underscore character in
client request headers. If left at the default value
off, evaluation of such headers is subject to
the value of the ignore_invalid_headers
directive.

The error_page directive is one of NGINX's most flexible. Using this directive,


we may serve any page when an error condition presents. This page could be on
the local machine, but could also be a dynamic page produced by an application


server, and could even be a page on a completely different site.


http {

# a generic error page to handle any server-level errors
error_page 500 501 502 503 504 share/examples/nginx/50x.html;

server {

server_name http://www.example.com;

root /home/customer/html;

# for any files not found, the page located at
# /home/customer/html/404.html will be delivered
error_page 404 /404.html;
Free download pdf