user www-data; pid /run/nginx.pid; # Determine max possible open file count. # Hard # ulimit -Hn; # 65536.# Soft # ulimit -Sn; # 1024. # Set soft as hard; # ulimit -n 65536; worker_rlimit_nofile 65536; # ulimit # you must set worker processes based on your CPU cores, nginx does not benefit from setting more than that worker_processes auto; #some last versions calculate it automatically events { worker_connections 65536; # ulimit # optmized to serve many clients with each thread, essential for linux -- for testing environment use epoll; # accept as many connections as possible, may flood worker connections if set too low -- for testing environment multi_accept on; } http { # copies data between one FD and other from within the kernel. # faster then read() + write() sendfile on; # send headers in one peace, its better then sending them one by one tcp_nopush on; # don't buffer data sent, good for small data bursts in real time tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; # keep track of every requested files for 2 minutes max, while expiring resources after 1 minute. open_file_cache max=500 inactive=20m; open_file_cache_valid 20m; include /etc/nginx/mime.types; default_type application/octet-stream; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE ssl_prefer_server_ciphers on; log_format mycombined '$remote_addr - $remote_user [$time_local] ' '"$request" $status $body_bytes_sent ' '"$http_referer" "$http_user_agent"'; access_log /var/log/nginx/access.log mycombined; error_log /var/log/nginx/error.log crit; # Will be included in each site from snippets/gzip.conf gzip off; # PHP Cache init settings. Does not mean that cache is being used. fastcgi_cache_path /tmp/cache_1h levels=1:2 keys_zone=cache_1h:100m max_size=100m inactive=1h; fastcgi_cache_path /tmp/cache_1h_auth levels=1:2 keys_zone=cache_1h_auth:100m max_size=100m inactive=1h; fastcgi_cache_path /tmp/cache_5m_auth levels=1:2 keys_zone=cache_5m_auth:100m max_size=100m inactive=5m; fastcgi_ignore_headers Cache-Control Expires Set-Cookie; fastcgi_cache_methods GET HEAD; # Only GET and HEAD methods apply include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; }