Mastering Nginx

(Ron) #1

A Configuration Guide


[ 24 ]

# the product of this number and the number of worker_processes
# indicates how many simultaneous connections per IP:port pair are
# accepted
worker_connections 2048;

}

This section would be placed at the top of the nginx.conf configuration file.


Using include files


Include files can be used anywhere in your configuration file, to help it be more


readable and to enable you to re-use parts of your configuration. To use them, make
sure that the files themselves contain the syntactically correct NGINX configuration


directives and blocks; then specify a path to those files:


include /opt/local/etc/nginx/mime.types;


A wildcard may appear in the path to match multiple files:


include /opt/local/etc/nginx/vhost/*.conf;


If the full path is not given, NGINX will search relative to its main configuration file.


A configuration file can be easily tested by calling NGINX as follows:


nginx -t -c <path-to-nginx.conf>


This will test the configuration including all the files separated out into include files,


for syntax errors.


The HTTP server section


The HTTP server section, or HTTP configuration context, is available unless you have


built NGINX without the HTTP module (--without-http). This section controls all
the aspects of working with the HTTP module, and will probably be the one that you


will use the most.


The configuration directives found in this section deal with handling HTTP


connections. As such, there are quite a number of directives defined by this module
We will divide these directives up by type, to be able to talk about them more easily.

Free download pdf