Nginx HTTP configuration is composed by three types of
sections
http: it defines the
gobal http related settings. It is the container of ‘server’ module.
Server: it defines a specific site (virtual host) on the
nginx server. It can be only defined within the http section
Location: it defines a specific location of the site (vhost).
It can be defined in server or other location sections.
Here are the most common configuration for nginx:
Server and socket:
-listen: (server):
specify the IP and ports of the host
-server_name (server): specify the http request’s HTTP host
field the server section will server for.
-server_name_hash_max_size (http): the internal hash table
size maximane size.
-server_names_hash_bucket_size (http): the internal hash entry
bucket maximane length.
-tcp_nodelay (http,server,location): no delay option for tcp, only when keep-alive
is on
-tcp_nopush (http,server,location): tcp_nopush or tcp_cork option for tcp, only
when sendfile is on
-sendfile (http,server,location): if using sendfile syscall
to handle the file transfer.
- keepailve-requests(http,server,location): the maxamine requests for
each keep-alive connections
- keepalive_timeout(http,server,location): the keep_alive timeout
value.
Document and location:
-root (http,server,location):
the document root location
- alias (location): provides an
alias for some specific location.but does not change the root.
-error_page (http,server,location)
set the http error code and it’s correspondent error page.
-if_modified_since (http,server,location):
define if the modified time setting in http request should be exactly matched
or not.
-index (http,server,location):
set the index page , the server will search the order list.
-try_files (location):
try to match / set the search pattern for the files if not existing, the
pass to the last specified location to handle it.
MINE type:
Usually we
only need to include the mime.types; file
-types:overwrites MINE type in HTTP
header’s content-type
Other advanced
options can be see other oline tools.
No comments:
Post a Comment