139 lines
4.1 KiB
Nginx Configuration File
139 lines
4.1 KiB
Nginx Configuration File
# Defines user and group credentials used by worker processes.
|
|
user nginx;
|
|
|
|
# Defines the number of worker processes. Generally, it should match the number of CPU cores.
|
|
worker_processes auto;
|
|
|
|
# Binds worker processes to the sets of CPUs.
|
|
worker_cpu_affinity auto;
|
|
|
|
# Change the default thread pool settings
|
|
thread_pool default threads=2 max_queue=16384;
|
|
|
|
# Limit on the maximum number of open files (RLIMIT_NOFILE) for worker processes.
|
|
worker_rlimit_nofile 32768;
|
|
|
|
# Logging configuration.
|
|
error_log /var/log/nginx/error.log notice;
|
|
|
|
# Defines a file that will store the process ID of the main process.
|
|
pid /var/run/nginx.pid;
|
|
|
|
events {
|
|
# Maximum number of simultaneous connections that can be opened by a worker process.
|
|
worker_connections 16384;
|
|
|
|
# Serve many clients each thread (Linux only)
|
|
use epoll;
|
|
|
|
# Accept as many connections as possible. If it is disabled, a worker process will accept one new connection at a time.
|
|
multi_accept on;
|
|
}
|
|
|
|
http {
|
|
# Copies data between one FD and other from within the kernel
|
|
# faster than read() + write()
|
|
sendfile on;
|
|
|
|
# Use the default thread pool for asynchronous file I/O
|
|
aio threads;
|
|
|
|
# Only use AIO is used for when larger than or equal to this size
|
|
directio 6m;
|
|
|
|
# Send headers in one piece, it is better than sending them one by one
|
|
tcp_nopush on;
|
|
|
|
# Don't buffer data sent, good for small data bursts in real time
|
|
tcp_nodelay on;
|
|
|
|
# Disable logging if a file can't be found
|
|
log_not_found off;
|
|
|
|
# Server will close connection after this time
|
|
keepalive_timeout 60;
|
|
|
|
# Max size of types hash tables (processing static sets of data. eg. server names, map directives or mime types)
|
|
types_hash_max_size 2048;
|
|
|
|
# Max allowed size of the client request body
|
|
client_max_body_size 250M;
|
|
|
|
# If the request body size is more than the buffer size, then the entire (or partial)
|
|
# request body is written into a temporary file
|
|
client_body_buffer_size 512k;
|
|
|
|
# Request timed out
|
|
client_body_timeout 300s;
|
|
|
|
# Allow the server to close connection on non responding client, this will free up memory
|
|
reset_timedout_connection on;
|
|
|
|
# Include MIME (Multipurpose Internet Mail Extensions) types.
|
|
include /etc/nginx/mime.types;
|
|
|
|
# Defines the default MIME type of a response
|
|
default_type application/octet-stream;
|
|
|
|
# Configures logging.
|
|
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
|
'$status $body_bytes_sent "$http_referer" '
|
|
'"$http_user_agent" "$http_x_forwarded_for"';
|
|
|
|
# Sets the path, format, and configuration for a buffered log write.
|
|
access_log /var/log/nginx/access.log main;
|
|
|
|
# Enabled compression using the “gzip” method.
|
|
gzip on;
|
|
|
|
# Disables gzipping of responses for requests with “User-Agent” header fields matching any of the specified regular expressions.
|
|
gzip_disable msie6;
|
|
|
|
# Enables inserting the “Vary: Accept-Encoding” response header field.
|
|
gzip_vary on;
|
|
|
|
# Sets a gzip compression level of a response. Acceptable values are in the range from 1 to 9.
|
|
gzip_comp_level 3;
|
|
|
|
# Sets the minimum length of a response that will be gzipped.
|
|
gzip_min_length 256;
|
|
|
|
# Sets the number and size of buffers used to compress a response.
|
|
gzip_buffers 16 8k;
|
|
|
|
# Enables compression for all proxied requests.
|
|
gzip_proxied any;
|
|
|
|
# Enables gzipping of responses for the specified MIME types in addition to “text/html”.
|
|
gzip_types
|
|
text/css
|
|
text/plain
|
|
text/javascript
|
|
text/cache-manifest
|
|
text/vcard
|
|
text/vnd.rim.location.xloc
|
|
text/vtt
|
|
text/x-component
|
|
text/x-cross-domain-policy
|
|
application/javascript
|
|
application/json
|
|
application/x-javascript
|
|
application/ld+json
|
|
application/xml
|
|
application/xml+rss
|
|
application/xhtml+xml
|
|
application/x-font-ttf
|
|
application/x-font-opentype
|
|
application/vnd.ms-fontobject
|
|
application/manifest+json
|
|
application/rss+xml
|
|
application/atom_xml
|
|
application/vnd.geo+json
|
|
application/x-web-app-manifest+json
|
|
image/svg+xml
|
|
image/x-icon
|
|
image/bmp
|
|
font/opentype;
|
|
|
|
include /etc/nginx/conf.d/*.conf;
|
|
} |