2016-01-23 14:45:07 +01:00
|
|
|
# Configuration File - Nginx Server Configs
|
|
|
|
# http://nginx.org/en/docs/dirindex.html
|
2013-03-29 22:49:16 +01:00
|
|
|
|
2016-01-23 14:45:07 +01:00
|
|
|
# Run as a unique, less privileged user for security reasons.
|
2017-05-06 18:30:09 +02:00
|
|
|
# Default: nobody nobody
|
2013-01-12 20:33:17 +01:00
|
|
|
user www www;
|
2010-12-15 06:12:17 +01:00
|
|
|
|
2016-01-23 14:45:07 +01:00
|
|
|
# Sets the worker threads to the number of CPU cores available in the system for best performance.
|
|
|
|
# Should be > the number of CPU cores.
|
|
|
|
# Maximum number of connections = worker_processes * worker_connections
|
2017-05-06 18:30:09 +02:00
|
|
|
# Default: 1
|
2015-08-30 03:05:56 +02:00
|
|
|
worker_processes auto;
|
2010-12-15 06:12:17 +01:00
|
|
|
|
2016-01-23 14:45:07 +01:00
|
|
|
# Maximum number of open files per worker process.
|
|
|
|
# Should be > worker_connections.
|
2017-05-06 18:30:09 +02:00
|
|
|
# Default: no limit
|
2010-12-15 06:12:17 +01:00
|
|
|
worker_rlimit_nofile 8192;
|
|
|
|
|
|
|
|
events {
|
2016-01-23 14:45:07 +01:00
|
|
|
# If you need more connections than this, you start optimizing your OS.
|
2016-03-22 16:23:52 +01:00
|
|
|
# That's probably the point at which you hire people who are smarter than you as this is *a lot* of requests.
|
2016-01-23 14:45:07 +01:00
|
|
|
# Should be < worker_rlimit_nofile.
|
2017-05-06 18:30:09 +02:00
|
|
|
# Default: 512
|
2013-01-12 21:16:02 +01:00
|
|
|
worker_connections 8000;
|
2010-12-15 06:12:17 +01:00
|
|
|
}
|
|
|
|
|
2016-01-23 14:45:07 +01:00
|
|
|
# Log errors and warnings to this file
|
|
|
|
# This is only used when you don't override it on a server{} level
|
2017-05-06 18:30:09 +02:00
|
|
|
# Default: logs/error.log error
|
2013-02-24 21:57:50 +01:00
|
|
|
error_log logs/error.log warn;
|
2016-01-23 14:45:07 +01:00
|
|
|
|
|
|
|
# The file storing the process ID of the main process
|
2017-05-06 18:30:09 +02:00
|
|
|
# Default: nginx.pid
|
2013-02-24 21:57:50 +01:00
|
|
|
pid /var/run/nginx.pid;
|
2010-12-15 06:12:17 +01:00
|
|
|
|
|
|
|
http {
|
2013-03-29 22:49:16 +01:00
|
|
|
|
2013-02-24 21:57:50 +01:00
|
|
|
# Hide nginx version information.
|
2017-05-06 18:30:09 +02:00
|
|
|
# Default: on
|
2013-02-24 21:57:50 +01:00
|
|
|
server_tokens off;
|
2010-12-15 06:12:17 +01:00
|
|
|
|
2016-01-23 14:45:07 +01:00
|
|
|
# Specify MIME types for files.
|
2014-08-13 13:00:14 +02:00
|
|
|
include mime.types;
|
2017-05-06 18:30:09 +02:00
|
|
|
|
|
|
|
# Default: text/plain
|
2013-02-24 21:57:50 +01:00
|
|
|
default_type application/octet-stream;
|
2010-12-15 06:12:17 +01:00
|
|
|
|
2016-01-23 14:45:07 +01:00
|
|
|
# Update charset_types to match updated mime.types.
|
|
|
|
# text/html is always included by charset module.
|
2017-05-06 18:30:09 +02:00
|
|
|
# Default: text/html text/xml text/plain text/vnd.wap.wml application/javascript application/rss+xml
|
2016-08-20 17:17:01 +02:00
|
|
|
charset_types
|
|
|
|
text/css
|
|
|
|
text/plain
|
|
|
|
text/vnd.wap.wml
|
2017-12-10 21:35:38 +01:00
|
|
|
text/javascript
|
2016-08-20 17:17:01 +02:00
|
|
|
application/json
|
|
|
|
application/rss+xml
|
|
|
|
application/xml;
|
2014-01-16 10:09:05 +01:00
|
|
|
|
2016-01-23 14:45:07 +01:00
|
|
|
# Include $http_x_forwarded_for within default format used in log files
|
2013-02-24 21:44:12 +01:00
|
|
|
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
|
|
|
'$status $body_bytes_sent "$http_referer" '
|
|
|
|
'"$http_user_agent" "$http_x_forwarded_for"';
|
2010-12-15 06:12:17 +01:00
|
|
|
|
2016-01-23 14:45:07 +01:00
|
|
|
# Log access to this file
|
|
|
|
# This is only used when you don't override it on a server{} level
|
2017-05-06 18:30:09 +02:00
|
|
|
# Default: logs/access.log combined
|
2013-01-12 20:33:17 +01:00
|
|
|
access_log logs/access.log main;
|
2010-12-15 06:12:17 +01:00
|
|
|
|
2016-01-23 14:45:07 +01:00
|
|
|
# How long to allow each connection to stay idle.
|
|
|
|
# Longer values are better for each individual client, particularly for SSL,
|
|
|
|
# but means that worker connections are tied up longer.
|
2017-05-06 18:30:09 +02:00
|
|
|
# Default: 75s
|
2016-01-23 14:59:22 +01:00
|
|
|
keepalive_timeout 20s;
|
2010-12-15 06:12:17 +01:00
|
|
|
|
2013-02-24 21:57:50 +01:00
|
|
|
# Speed up file transfers by using sendfile() to copy directly
|
|
|
|
# between descriptors rather than using read()/write().
|
2015-12-04 15:25:31 +01:00
|
|
|
# For performance reasons, on FreeBSD systems w/ ZFS
|
2015-07-06 19:10:45 +02:00
|
|
|
# this option should be disabled as ZFS's ARC caches
|
|
|
|
# frequently used files in RAM by default.
|
2017-05-06 18:30:09 +02:00
|
|
|
# Default: off
|
2013-02-24 21:57:50 +01:00
|
|
|
sendfile on;
|
2010-12-15 06:12:17 +01:00
|
|
|
|
2016-01-23 14:45:07 +01:00
|
|
|
# Don't send out partial frames; this increases throughput
|
|
|
|
# since TCP frames are filled up before being sent out.
|
2017-05-06 18:30:09 +02:00
|
|
|
# Default: off
|
2013-02-24 21:57:50 +01:00
|
|
|
tcp_nopush on;
|
2010-12-15 06:12:17 +01:00
|
|
|
|
2016-01-23 14:45:07 +01:00
|
|
|
# Enable gzip compression.
|
2017-05-06 18:30:09 +02:00
|
|
|
# Default: off
|
2011-07-07 02:11:50 +02:00
|
|
|
gzip on;
|
2013-03-29 22:49:16 +01:00
|
|
|
|
|
|
|
# Compression level (1-9).
|
2016-01-23 14:45:07 +01:00
|
|
|
# 5 is a perfect compromise between size and CPU usage, offering about
|
|
|
|
# 75% reduction for most ASCII files (almost identical to level 9).
|
2017-05-06 18:30:09 +02:00
|
|
|
# Default: 1
|
2013-03-29 22:49:16 +01:00
|
|
|
gzip_comp_level 5;
|
|
|
|
|
|
|
|
# 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
|
|
|
|
# larger files after gzipping).
|
2017-05-06 18:30:09 +02:00
|
|
|
# Default: 20
|
2013-03-29 22:49:16 +01:00
|
|
|
gzip_min_length 256;
|
|
|
|
|
|
|
|
# Compress data even for clients that are connecting to us via proxies,
|
|
|
|
# identified by the "Via" header (required for CloudFront).
|
2017-05-06 18:30:09 +02:00
|
|
|
# Default: off
|
2013-03-29 22:49:16 +01:00
|
|
|
gzip_proxied any;
|
|
|
|
|
|
|
|
# Tell proxies to cache both the gzipped and regular version of a resource
|
|
|
|
# whenever the client's Accept-Encoding capabilities header varies;
|
|
|
|
# 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.
|
2017-05-06 18:30:09 +02:00
|
|
|
# Default: off
|
2013-03-29 22:49:16 +01:00
|
|
|
gzip_vary on;
|
|
|
|
|
|
|
|
# Compress all output labeled with one of the following MIME-types.
|
2016-08-20 17:17:01 +02:00
|
|
|
# text/html is always compressed by gzip module.
|
2017-05-06 18:30:09 +02:00
|
|
|
# Default: text/html
|
2011-02-02 00:21:18 +01:00
|
|
|
gzip_types
|
2013-03-29 22:49:16 +01:00
|
|
|
application/atom+xml
|
2011-02-02 00:21:18 +01:00
|
|
|
application/javascript
|
|
|
|
application/json
|
2015-03-25 10:10:01 +01:00
|
|
|
application/ld+json
|
|
|
|
application/manifest+json
|
2013-03-29 22:49:16 +01:00
|
|
|
application/rss+xml
|
2018-11-23 12:56:17 +01:00
|
|
|
application/geo+json
|
2011-02-02 00:21:18 +01:00
|
|
|
application/vnd.ms-fontobject
|
2013-03-29 22:49:16 +01:00
|
|
|
application/x-font-ttf
|
|
|
|
application/x-web-app-manifest+json
|
|
|
|
application/xhtml+xml
|
|
|
|
application/xml
|
2018-11-23 12:56:17 +01:00
|
|
|
application/rdf+xml
|
2017-12-10 21:35:38 +01:00
|
|
|
font/collection
|
2013-03-29 22:49:16 +01:00
|
|
|
font/opentype
|
2017-12-10 21:35:38 +01:00
|
|
|
font/otf
|
|
|
|
font/ttf
|
2015-03-25 10:10:01 +01:00
|
|
|
image/bmp
|
2012-06-19 07:00:12 +02:00
|
|
|
image/svg+xml
|
2013-03-29 22:49:16 +01:00
|
|
|
image/x-icon
|
2015-03-25 10:10:01 +01:00
|
|
|
text/cache-manifest
|
2013-03-29 22:49:16 +01:00
|
|
|
text/css
|
2017-12-10 21:35:38 +01:00
|
|
|
text/javascript
|
2013-03-29 22:49:16 +01:00
|
|
|
text/plain
|
2015-03-25 10:10:01 +01:00
|
|
|
text/vcard
|
|
|
|
text/vnd.rim.location.xloc
|
|
|
|
text/vtt
|
|
|
|
text/x-component
|
2015-07-21 11:34:05 +02:00
|
|
|
text/x-cross-domain-policy;
|
2013-03-29 22:49:16 +01:00
|
|
|
|
2011-07-07 02:11:50 +02:00
|
|
|
# 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
|
2013-02-24 21:57:50 +01:00
|
|
|
# for the check. It is best if you enable this in a location{} block for
|
|
|
|
# a specific directory, or on an individual server{} level.
|
2011-07-07 02:11:50 +02:00
|
|
|
# gzip_static on;
|
2010-12-15 06:12:17 +01:00
|
|
|
|
2015-06-12 15:52:16 +02:00
|
|
|
# Include files in the sites-enabled folder. server{} configuration files should be
|
2015-06-11 16:27:20 +02:00
|
|
|
# placed in the sites-available folder, and then the configuration should be enabled
|
2015-11-25 09:49:15 +01:00
|
|
|
# by creating a symlink to it in the sites-enabled folder.
|
2015-06-12 15:52:16 +02:00
|
|
|
# See doc/sites-enabled.md for more info.
|
2012-07-23 12:45:05 +02:00
|
|
|
include sites-enabled/*;
|
2010-12-15 06:12:17 +01:00
|
|
|
}
|