
https://blog.evernote.com/tech/2017/02/08/part-2-protecting-customer-data-gcp/
СТАТЬЯ №2
Size: a a a
# nginx file configured for Optimized Performance
# proudly by DevOps 90min ¯\_(ツ)_/¯
user nginx nginx;
# auto - nginx will detect number of cpu and make ideal number of workers
worker_processes auto;
# # [ debug | info | notice | warn | error | crit | alert | emerg ]
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
# Changes the limit on the maximum number of open files (RLIMIT_NOFILE) for worker processes.
# Used to increase the limit without restarting the main process.
worker_rlimit_nofile 8192;
# use epoll - is a scalable I/O event notification mechanism to trigger on events and make sure that I/O is utilized to the best of its ability.
# multi_accept in order for a worker to accept all new connections at one time.
events {
worker_connections 66536;
use epoll;
multi_accept on;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
# sendfile - optimizes serving static files from the file system, like logos.
sendfile on;
# tcp_nopush - optimizes the amount of data sent down the wire at once by activating the TCP_CORK
# option within the TCP stack. TCP_CORK blocks the data until the packet reaches the MSS,
# which is equal to the MTU minus the 40 or 60 bytes of the IP header.
tcp_nopush on;
# tcp_nodelay - allows nginx to make TCP send multiple buffers as individual packets.
tcp_nodelay on;
# keepalive_timeout and keepalive_requests control the keep alive settings.
keepalive_timeout 65;
keepalive_requests 100000;
# server_names_hash_max_size - Sets the maximum size of the server names hash tables.
server_names_hash_max_size 512;
# client_header_timeout - sends directives for the time a server will wait for a header body to be sent.
client_header_timeout 3m;
# client_body_timeout - sends directives for the time a server will wait for a body to be sent.
client_body_timeout 3m;
# send_timeout - specifies the response timeout to the client.
send_timeout 3m;
# client_header_buffer_size - handles the client header size.
client_header_buffer_size 1k;
# client_max_body_size - sets the max body buffer size.
client_max_body_size 10m;
# client_body_buffer_size - handles the client buffer size.
client_body_buffer_size 128k;
# large_client_header_buffers - shows the maximum number and size of buffers for large client headers.
large_client_header_buffers 4 4k;
# output_buffers - sets the number and size of the buffers used for reading a response from a disk.
output_buffers 1 32k;
# postpone_output - client data will be postponed until nginx has at least size bytes of data to send.
postpone_output 1460;
# gzip compression
gzip on;
gzip_disable "MSIE [1-6]\.";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_min_length 1000;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon;
include /etc/nginx/conf.d/*.conf;
}