Improve comments in nginx.conf

This commit is contained in:
Craig Davison 2016-01-23 13:45:07 +00:00
parent 66d0c463e0
commit 605ec6f8c3
1 changed files with 30 additions and 34 deletions

View File

@ -1,32 +1,30 @@
# nginx Configuration File # Configuration File - Nginx Server Configs
# http://wiki.nginx.org/Configuration # http://nginx.org/en/docs/dirindex.html
# Run as a less privileged user for security reasons. # Run as a unique, less privileged user for security reasons.
user www www; user www www;
# How many worker threads to run; # Sets the worker threads to the number of CPU cores available in the system for best performance.
# "auto" sets it to the number of CPU cores available in the system, and # Should be > the number of CPU cores.
# offers the best performance. Don't set it higher than the number of CPU # Maximum number of connections = worker_processes * worker_connections
# cores if changing this parameter.
# The maximum number of connections for Nginx is calculated by:
# max_clients = worker_processes * worker_connections
worker_processes auto; worker_processes auto;
# Maximum open file descriptors per process; # Maximum number of open files per worker process.
# should be > worker_connections. # Should be > worker_connections.
worker_rlimit_nofile 8192; worker_rlimit_nofile 8192;
events { events {
# When you need > 8000 * cpu_cores connections, you start optimizing your OS, # If you need more connections than this, you start optimizing your OS.
# and this is probably the point at which you hire people who are smarter than # That's probably the point at which you hire people who are smarter than you at this is *a lot* of requests.
# you, as this is *a lot* of requests. # Should be < worker_rlimit_nofile.
worker_connections 8000; worker_connections 8000;
} }
# Default error log file # Log errors and warnings to this file
# (this is only used when you don't override error_log on a server{} level) # This is only used when you don't override it on a server{} level
error_log logs/error.log warn; error_log logs/error.log warn;
# The file storing the process ID of the main process
pid /var/run/nginx.pid; pid /var/run/nginx.pid;
http { http {
@ -34,25 +32,26 @@ http {
# Hide nginx version information. # Hide nginx version information.
server_tokens off; server_tokens off;
# Define the MIME types for files. # Specify MIME types for files.
include mime.types; include mime.types;
default_type application/octet-stream; default_type application/octet-stream;
# Update charset_types due to updated mime.types # Update charset_types to match updated mime.types.
# text/html is always included by charset module.
charset_types text/css text/plain text/vnd.wap.wml application/javascript application/json application/rss+xml application/xml; charset_types text/css text/plain text/vnd.wap.wml application/javascript application/json application/rss+xml application/xml;
# Format to use in log files # Include $http_x_forwarded_for within default format used in log files
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" ' '$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"'; '"$http_user_agent" "$http_x_forwarded_for"';
# Default log file # Log access to this file
# (this is only used when you don't override access_log on a server{} level) # This is only used when you don't override it on a server{} level
access_log logs/access.log main; access_log logs/access.log main;
# How long to allow each connection to stay idle; longer values are better # How long to allow each connection to stay idle.
# for each individual client, particularly for SSL, but means that worker # Longer values are better for each individual client, particularly for SSL,
# connections are tied up longer. (Default: 75s) # but means that worker connections are tied up longer.
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
@ -62,19 +61,16 @@ http {
# frequently used files in RAM by default. # frequently used files in RAM by default.
sendfile on; sendfile on;
# Tell Nginx not to 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. (adds TCP_CORK) # since TCP frames are filled up before being sent out.
tcp_nopush on; tcp_nopush on;
# Enable gzip compression.
# Compression
# Enable Gzip compressed.
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).
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
@ -118,7 +114,7 @@ http {
text/vtt text/vtt
text/x-component text/x-component
text/x-cross-domain-policy; text/x-cross-domain-policy;
# text/html is always compressed by HttpGzipModule # text/html is always compressed by gzip module
# This should be turned on if you are going to have pre-compressed copies (.gz) of # This should be turned on if you are going to have pre-compressed copies (.gz) of
# static files available. If not it should be left off as it will cause extra I/O # static files available. If not it should be left off as it will cause extra I/O