From 3d6844a7b7c9c180e840be86a2e085f5c1381e18 Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Mon, 14 Nov 2016 11:55:37 +0200 Subject: [PATCH] roles/nginx: Update comments in nginx.conf Update comments from latest copy of the HTML 5 Boilerplate's nginx server configs repo. See: https://github.com/h5bp/server-configs-nginx/blob/master/nginx.conf --- roles/nginx/files/nginx.conf | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/roles/nginx/files/nginx.conf b/roles/nginx/files/nginx.conf index 6a29ffe..125e70b 100644 --- a/roles/nginx/files/nginx.conf +++ b/roles/nginx/files/nginx.conf @@ -1,12 +1,24 @@ +# Run as a unique, less privileged user for security reasons. user nginx; + +# Sets the worker threads to the number of CPU cores available in the system for best performance. +# Should be > the number of CPU cores. +# Maximum number of connections = worker_processes * worker_connections worker_processes auto; +# Log errors and warnings to this file +# This is only used when you don't override it on a server{} level error_log /var/log/nginx/error.log error; + +# The file storing the process ID of the main process pid /var/run/nginx.pid; events { + # If you need more connections than this, you start optimizing your OS. + # That's probably the point at which you hire people who are smarter than you as this is *a lot* of requests. + # Should be < worker_rlimit_nofile. worker_connections 1024; } @@ -15,10 +27,12 @@ http { include /etc/nginx/mime.types; default_type application/octet-stream; + # Include $http_x_forwarded_for within default format used 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"'; + # Hide nginx version information. server_tokens off; access_log off; @@ -30,8 +44,8 @@ http { # frequently used files in RAM by default. sendfile on; - # Tell Nginx not to send out partial frames; this increases throughput - # since TCP frames are filled up before being sent out. (adds TCP_CORK) + # Don't send out partial frames; this increases throughput + # since TCP frames are filled up before being sent out. tcp_nopush on; keepalive_timeout 65s;