2014-08-16 23:35:57 +02:00
|
|
|
|
2016-11-14 10:55:37 +01:00
|
|
|
# Run as a unique, less privileged user for security reasons.
|
2017-01-30 14:45:50 +01:00
|
|
|
user nginx;
|
2016-11-14 10:55:37 +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
|
2014-08-16 23:35:57 +02:00
|
|
|
worker_processes auto;
|
|
|
|
|
2016-11-14 10:55:37 +01:00
|
|
|
# Log errors and warnings to this file
|
|
|
|
# This is only used when you don't override it on a server{} level
|
2016-11-14 10:58:51 +01:00
|
|
|
error_log /var/log/nginx/error.log warn;
|
2016-11-14 10:55:37 +01:00
|
|
|
|
|
|
|
# The file storing the process ID of the main process
|
2014-08-16 23:35:57 +02:00
|
|
|
pid /var/run/nginx.pid;
|
|
|
|
|
|
|
|
|
|
|
|
events {
|
2016-11-14 10:55:37 +01:00
|
|
|
# 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.
|
|
|
|
# Should be < worker_rlimit_nofile.
|
2014-08-16 23:35:57 +02:00
|
|
|
worker_connections 1024;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
http {
|
|
|
|
include /etc/nginx/mime.types;
|
|
|
|
default_type application/octet-stream;
|
|
|
|
|
2016-11-14 10:55:37 +01:00
|
|
|
# Include $http_x_forwarded_for within default format used in log files
|
2014-08-16 23:35:57 +02:00
|
|
|
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
|
|
|
'$status $body_bytes_sent "$http_referer" '
|
|
|
|
'"$http_user_agent" "$http_x_forwarded_for"';
|
|
|
|
|
2016-11-14 10:55:37 +01:00
|
|
|
# Hide nginx version information.
|
2014-08-16 23:35:57 +02:00
|
|
|
server_tokens off;
|
|
|
|
|
|
|
|
access_log off;
|
|
|
|
|
2016-03-12 18:27:56 +01:00
|
|
|
# Speed up file transfers by using sendfile() to copy directly
|
|
|
|
# between descriptors rather than using read()/write().
|
|
|
|
# For performance reasons, on FreeBSD systems w/ ZFS
|
|
|
|
# this option should be disabled as ZFS's ARC caches
|
|
|
|
# frequently used files in RAM by default.
|
2014-08-16 23:35:57 +02:00
|
|
|
sendfile on;
|
2016-03-13 23:07:35 +01:00
|
|
|
|
2016-11-14 10:55:37 +01:00
|
|
|
# Don't send out partial frames; this increases throughput
|
|
|
|
# since TCP frames are filled up before being sent out.
|
2016-03-13 23:07:35 +01:00
|
|
|
tcp_nopush on;
|
2014-08-16 23:35:57 +02:00
|
|
|
|
2016-03-12 18:02:57 +01:00
|
|
|
keepalive_timeout 65s;
|
2014-08-16 23:35:57 +02:00
|
|
|
|
|
|
|
gzip on;
|
2016-03-12 18:25:57 +01:00
|
|
|
|
|
|
|
# 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.
|
2014-08-16 23:35:57 +02:00
|
|
|
gzip_vary on;
|
2016-11-14 11:32:39 +01:00
|
|
|
|
|
|
|
# Compression level (1-9).
|
|
|
|
# 5 is a perfect compromise between size and CPU usage, offering about
|
|
|
|
# 75% reduction for most ASCII files (almost identical to level 9).
|
2016-11-14 11:08:21 +01:00
|
|
|
gzip_comp_level 5;
|
2016-11-14 11:32:39 +01:00
|
|
|
|
2016-11-14 11:46:34 +01:00
|
|
|
# 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).
|
|
|
|
gzip_min_length 256;
|
|
|
|
|
2014-08-16 23:35:57 +02:00
|
|
|
gzip_disable "msie6";
|
|
|
|
gzip_http_version 1.1;
|
2016-11-14 11:28:18 +01:00
|
|
|
# Compress all output labeled with one of the following MIME-types.
|
|
|
|
gzip_types
|
|
|
|
application/atom+xml
|
|
|
|
application/javascript
|
|
|
|
application/json
|
|
|
|
application/ld+json
|
|
|
|
application/manifest+json
|
|
|
|
application/rss+xml
|
|
|
|
application/vnd.geo+json
|
|
|
|
application/vnd.ms-fontobject
|
|
|
|
application/x-font-ttf
|
|
|
|
application/x-web-app-manifest+json
|
|
|
|
application/xhtml+xml
|
|
|
|
application/xml
|
|
|
|
font/opentype
|
|
|
|
image/bmp
|
|
|
|
image/svg+xml
|
|
|
|
image/x-icon
|
|
|
|
text/cache-manifest
|
|
|
|
text/css
|
|
|
|
text/plain
|
|
|
|
text/vcard
|
|
|
|
text/vnd.rim.location.xloc
|
|
|
|
text/vtt
|
|
|
|
text/x-component
|
|
|
|
text/x-cross-domain-policy;
|
|
|
|
# text/html is always compressed by gzip module
|
2014-08-16 23:35:57 +02:00
|
|
|
|
|
|
|
client_max_body_size 12m;
|
|
|
|
|
2015-02-10 21:04:28 +01:00
|
|
|
include fastcgi_cache;
|
2014-08-16 23:35:57 +02:00
|
|
|
include /etc/nginx/conf.d/*.conf;
|
|
|
|
}
|