Add defaults to all directives in nginx.conf

The reason most of these are changed is already covered by the existing
doc block

closes #127
This commit is contained in:
Andy Dawson 2017-05-06 18:30:09 +02:00
parent eca3919c88
commit 3bda5b93ed
1 changed files with 20 additions and 0 deletions

View File

@ -2,42 +2,52 @@
# http://nginx.org/en/docs/dirindex.html # http://nginx.org/en/docs/dirindex.html
# Run as a unique, less privileged user for security reasons. # Run as a unique, less privileged user for security reasons.
# Default: nobody nobody
user www www; user www www;
# Sets the worker threads to the number of CPU cores available in the system for best performance. # Sets the worker threads to the number of CPU cores available in the system for best performance.
# Should be > the number of CPU cores. # Should be > the number of CPU cores.
# Maximum number of connections = worker_processes * worker_connections # Maximum number of connections = worker_processes * worker_connections
# Default: 1
worker_processes auto; worker_processes auto;
# Maximum number of open files per worker process. # Maximum number of open files per worker process.
# Should be > worker_connections. # Should be > worker_connections.
# Default: no limit
worker_rlimit_nofile 8192; worker_rlimit_nofile 8192;
events { events {
# If you need more connections than this, you start optimizing your OS. # If you need more connections than this, you start optimizing your OS.
# That's probably the point at which you hire people who are smarter than you as this is *a lot* of requests. # That's probably the point at which you hire people who are smarter than you as this is *a lot* of requests.
# Should be < worker_rlimit_nofile. # Should be < worker_rlimit_nofile.
# Default: 512
worker_connections 8000; worker_connections 8000;
} }
# Log errors and warnings to this file # Log errors and warnings to this file
# This is only used when you don't override it on a server{} level # This is only used when you don't override it on a server{} level
# Default: logs/error.log error
error_log logs/error.log warn; error_log logs/error.log warn;
# The file storing the process ID of the main process # The file storing the process ID of the main process
# Default: nginx.pid
pid /var/run/nginx.pid; pid /var/run/nginx.pid;
http { http {
# Hide nginx version information. # Hide nginx version information.
# Default: on
server_tokens off; server_tokens off;
# Specify MIME types for files. # Specify MIME types for files.
include mime.types; include mime.types;
# Default: text/plain
default_type application/octet-stream; default_type application/octet-stream;
# Update charset_types to match updated mime.types. # Update charset_types to match updated mime.types.
# text/html is always included by charset module. # text/html is always included by charset module.
# Default: text/html text/xml text/plain text/vnd.wap.wml application/javascript application/rss+xml
charset_types charset_types
text/css text/css
text/plain text/plain
@ -54,11 +64,13 @@ http {
# Log access to this file # Log access to this file
# This is only used when you don't override it on a server{} level # This is only used when you don't override it on a server{} level
# Default: logs/access.log combined
access_log logs/access.log main; access_log logs/access.log main;
# How long to allow each connection to stay idle. # How long to allow each connection to stay idle.
# Longer values are better for each individual client, particularly for SSL, # Longer values are better for each individual client, particularly for SSL,
# but means that worker connections are tied up longer. # but means that worker connections are tied up longer.
# Default: 75s
keepalive_timeout 20s; keepalive_timeout 20s;
# Speed up file transfers by using sendfile() to copy directly # Speed up file transfers by using sendfile() to copy directly
@ -66,37 +78,45 @@ http {
# For performance reasons, on FreeBSD systems w/ ZFS # For performance reasons, on FreeBSD systems w/ ZFS
# this option should be disabled as ZFS's ARC caches # this option should be disabled as ZFS's ARC caches
# frequently used files in RAM by default. # frequently used files in RAM by default.
# Default: off
sendfile on; sendfile on;
# Don't send out partial frames; this increases throughput # Don't send out partial frames; this increases throughput
# since TCP frames are filled up before being sent out. # since TCP frames are filled up before being sent out.
# Default: off
tcp_nopush on; tcp_nopush on;
# Enable gzip compression. # Enable gzip compression.
# Default: off
gzip on; gzip on;
# Compression level (1-9). # Compression level (1-9).
# 5 is a perfect compromise between size and CPU usage, offering about # 5 is a perfect compromise between size and CPU usage, offering about
# 75% reduction for most ASCII files (almost identical to level 9). # 75% reduction for most ASCII files (almost identical to level 9).
# Default: 1
gzip_comp_level 5; gzip_comp_level 5;
# Don't compress anything that's already small and unlikely to shrink much # Don't compress anything that's already small and unlikely to shrink much
# if at all (the default is 20 bytes, which is bad as that usually leads to # if at all (the default is 20 bytes, which is bad as that usually leads to
# larger files after gzipping). # larger files after gzipping).
# Default: 20
gzip_min_length 256; gzip_min_length 256;
# Compress data even for clients that are connecting to us via proxies, # Compress data even for clients that are connecting to us via proxies,
# identified by the "Via" header (required for CloudFront). # identified by the "Via" header (required for CloudFront).
# Default: off
gzip_proxied any; gzip_proxied any;
# Tell proxies to cache both the gzipped and regular version of a resource # Tell proxies to cache both the gzipped and regular version of a resource
# whenever the client's Accept-Encoding capabilities header varies; # whenever the client's Accept-Encoding capabilities header varies;
# Avoids the issue where a non-gzip capable client (which is extremely rare # Avoids the issue where a non-gzip capable client (which is extremely rare
# today) would display gibberish if their proxy gave them the gzipped version. # today) would display gibberish if their proxy gave them the gzipped version.
# Default: off
gzip_vary on; gzip_vary on;
# Compress all output labeled with one of the following MIME-types. # Compress all output labeled with one of the following MIME-types.
# text/html is always compressed by gzip module. # text/html is always compressed by gzip module.
# Default: text/html
gzip_types gzip_types
application/atom+xml application/atom+xml
application/javascript application/javascript