docker/prod/api/nginx/nginx.conf
user www-data;
pid /run/nginx.pid;
daemon off;
include /etc/nginx/main.d/*.conf;
# This number should be, at maximum, the number of CPU cores on your system.
worker_processes 1;
# Number of file descriptors used for Nginx.
worker_rlimit_nofile 131072;
events {
# Determines how many clients will be served by each worker process.
worker_connections 8192;
# The effective method, used on Linux 2.6+, optmized to serve many clients with each thread.
use epoll;
# Accept as many connections as possible, after nginx gets notification about a new connection.
multi_accept on;
}
http {
# Max size of request. Needs for huge post requests.
client_max_body_size 256M;
# Caches information about open FDs, freqently accessed files.
open_file_cache max=131072 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
# Disable access log altogether.
access_log off;
# Sendfile copies data between one FD and other from within the kernel.
sendfile on;
# Causes nginx to attempt to send its HTTP response head in one packet, instead of using partial frames.
tcp_nopush on;
# Don't buffer data-sends (disable Nagle algorithm).
tcp_nodelay on;
# Timeout for keep-alive connections. Server will close connections after this time.
keepalive_timeout 30;
# Number of requests a client can make over the keep-alive connection.
keepalive_requests 1000;
# Allow the server to close the connection after a client stops responding.
reset_timedout_connection on;
# Send the client a "request timed out" if the body is not loaded by this time.
client_body_timeout 10;
# Send the client a "request timed out" if the header is not loaded by this time.
client_header_timeout 10;
# If the client stops reading data, free up the stale client connection after this much time.
send_timeout 5;
# Compression.
gzip on;
gzip_comp_level 2;
gzip_min_length 1000;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain application/x-javascript text/xml text/css application/xml;
gzip_disable "msie6";
access_log /home/app/logs/nginx-app-server-access.log;
error_log /home/app/logs/nginx-app-server-error.log;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}