2013-03-29 22:49:16 +01:00
|
|
|
# nginx Configuration File
|
|
|
|
# http://wiki.nginx.org/Configuration
|
|
|
|
|
2013-02-24 21:57:50 +01:00
|
|
|
# Run as a less privileged user for security reasons.
|
2013-01-12 20:33:17 +01:00
|
|
|
user www www;
|
2010-12-15 06:12:17 +01:00
|
|
|
|
2013-03-29 22:49:16 +01:00
|
|
|
# How many worker threads to run;
|
|
|
|
# "auto" sets it to the number of CPU cores available in the system, and
|
|
|
|
# offers the best performance. Don't set it higher than the number of CPU
|
|
|
|
# cores if changing this parameter.
|
|
|
|
|
2010-12-15 06:12:17 +01:00
|
|
|
# The maximum number of connections for Nginx is calculated by:
|
|
|
|
# max_clients = worker_processes * worker_connections
|
2013-11-20 18:36:32 +01:00
|
|
|
worker_processes 2;
|
2010-12-15 06:12:17 +01:00
|
|
|
|
2013-02-24 21:57:50 +01:00
|
|
|
# Maximum open file descriptors per process;
|
|
|
|
# should be > worker_connections.
|
2010-12-15 06:12:17 +01:00
|
|
|
worker_rlimit_nofile 8192;
|
|
|
|
|
|
|
|
events {
|
2013-03-29 22:49:16 +01:00
|
|
|
# When you need > 8000 * cpu_cores connections, you start optimizing your OS,
|
2013-11-19 06:38:57 +01:00
|
|
|
# and this is probably the point at which you hire people who are smarter than
|
2013-03-29 22:49:16 +01:00
|
|
|
# you, as this is *a lot* of requests.
|
2013-01-12 21:16:02 +01:00
|
|
|
worker_connections 8000;
|
2010-12-15 06:12:17 +01:00
|
|
|
}
|
|
|
|
|
2013-03-29 22:49:16 +01:00
|
|
|
# Default error log file
|
|
|
|
# (this is only used when you don't override error_log on a server{} level)
|
2013-02-24 21:57:50 +01:00
|
|
|
error_log logs/error.log warn;
|
|
|
|
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.
|
|
|
|
server_tokens off;
|
2010-12-15 06:12:17 +01:00
|
|
|
|
2013-03-29 22:49:16 +01:00
|
|
|
# Define the MIME types for files.
|
2014-08-13 13:00:14 +02:00
|
|
|
include mime.types;
|
2013-02-24 21:57:50 +01:00
|
|
|
default_type application/octet-stream;
|
2010-12-15 06:12:17 +01:00
|
|
|
|
2014-01-16 10:09:05 +01:00
|
|
|
# Update charset_types due to updated mime.types
|
2014-01-30 22:23:31 +01:00
|
|
|
charset_types text/xml text/plain text/vnd.wap.wml application/x-javascript application/rss+xml text/css application/javascript application/json;
|
2014-01-16 10:09:05 +01:00
|
|
|
|
2013-02-24 21:44:12 +01:00
|
|
|
# Format to use in log files
|
|
|
|
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
|
|
|
|
2013-03-29 22:49:16 +01:00
|
|
|
# Default log file
|
|
|
|
# (this is only used when you don't override access_log on a server{} level)
|
2013-01-12 20:33:17 +01:00
|
|
|
access_log logs/access.log main;
|
2010-12-15 06:12:17 +01:00
|
|
|
|
2013-02-24 21:57:50 +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. (Default: 65)
|
2011-07-07 02:11:50 +02:00
|
|
|
keepalive_timeout 20;
|
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().
|
|
|
|
sendfile on;
|
2010-12-15 06:12:17 +01:00
|
|
|
|
2013-02-24 21:57:50 +01:00
|
|
|
# Tell Nginx not to send out partial frames; this increases throughput
|
|
|
|
# since TCP frames are filled up before being sent out. (adds TCP_CORK)
|
|
|
|
tcp_nopush on;
|
2010-12-15 06:12:17 +01:00
|
|
|
|
2013-03-29 22:49:16 +01:00
|
|
|
|
|
|
|
# Compression
|
|
|
|
|
|
|
|
# Enable Gzip compressed.
|
2011-07-07 02:11:50 +02:00
|
|
|
gzip on;
|
2013-03-29 22:49:16 +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).
|
|
|
|
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).
|
|
|
|
gzip_min_length 256;
|
|
|
|
|
|
|
|
# Compress data even for clients that are connecting to us via proxies,
|
|
|
|
# identified by the "Via" header (required for CloudFront).
|
|
|
|
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.
|
|
|
|
gzip_vary on;
|
|
|
|
|
|
|
|
# Compress all output labeled with one of the following MIME-types.
|
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
|
|
|
|
application/rdf+xml
|
2013-03-29 22:49:16 +01:00
|
|
|
application/rss+xml
|
2015-03-25 10:10:01 +01:00
|
|
|
application/schema+json
|
|
|
|
application/vnd.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
|
2015-03-25 10:10:01 +01:00
|
|
|
application/x-javascript
|
2013-03-29 22:49:16 +01:00
|
|
|
application/x-web-app-manifest+json
|
|
|
|
application/xhtml+xml
|
|
|
|
application/xml
|
2015-03-25 10:10:01 +01:00
|
|
|
font/eot
|
2013-03-29 22:49:16 +01:00
|
|
|
font/opentype
|
2015-03-25 10:10:01 +01:00
|
|
|
image/bmp
|
2012-06-19 07:00:12 +02:00
|
|
|
image/svg+xml
|
2015-03-25 10:10:01 +01:00
|
|
|
image/vnd.microsoft.icon
|
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
|
2015-03-25 10:10:01 +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
|
|
|
|
text/x-cross-domain-policy
|
|
|
|
text/xml;
|
2013-03-29 22:49:16 +01:00
|
|
|
# text/html is always compressed by HttpGzipModule
|
|
|
|
|
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
|
|
|
|
2012-07-23 12:45:05 +02:00
|
|
|
include sites-enabled/*;
|
2010-12-15 06:12:17 +01:00
|
|
|
}
|