diff --git a/nginx.conf b/nginx.conf index 66e1651..065542a 100644 --- a/nginx.conf +++ b/nginx.conf @@ -19,16 +19,6 @@ events { # your OS, and this is probably the point at where you hire people # who are smarter than you, this is *a lot* of requests. worker_connections 8000; - - # This sets up some smart queueing for accept(2)'ing requests - # Set it to "on" if you have > worker_processes - accept_mutex off; - - # These settings are OS specific, by defualt Nginx uses select(2), - # however, for a large number of requests epoll(2) and kqueue(2) - # are generally faster than the default (select(2)) - # use epoll; # enable for Linux 2.6+ - # use kqueue; # enable for *BSD (FreeBSD, OS X, ..) } # Change these paths to somewhere that suits you! @@ -52,7 +42,7 @@ http { # ~2 seconds is often enough for HTML/CSS, but connections in # Nginx are cheap, so generally it's safe to increase it - keepalive_timeout 5; + keepalive_timeout 20; # You usually want to serve static files with Nginx sendfile on; @@ -60,12 +50,12 @@ http { tcp_nopush on; # off may be better for Comet/long-poll stuff tcp_nodelay off; # on may be better for Comet/long-poll stuff - # Enable Gzip - gzip on; + # Enable Gzip: + gzip on; gzip_http_version 1.0; - gzip_comp_level 2; - gzip_min_length 1100; - gzip_buffers 4 8k; + gzip_comp_level 5; + gzip_min_length 512; + gzip_buffers 4 8k; gzip_proxied any; gzip_types # text/html is always compressed by HttpGzipModule @@ -83,20 +73,23 @@ http { application/vnd.ms-fontobject image/svg+xml; - gzip_static on; + # This should be turned on if you are going to have pre-compressed copies (.gz) of + # static files available. If not it should be left off as it will cause extra I/O + # for the check. It would be better to enable this in a location {} block for + # a specific directory: + # gzip_static on; - gzip_proxied expired no-cache no-store private auth; gzip_disable "MSIE [1-6]\."; gzip_vary on; server { - # listen 80 default deferred; # for Linux - # listen 80 default accept_filter=httpready; # for FreeBSD - listen 80 default; + # listen 80 default_server deferred; # for Linux + # listen 80 default_server accept_filter=httpready; # for FreeBSD + listen 80 default_server; # e.g. "localhost" to accept all connections, or "www.example.com" # to handle the requests for "example.com" (and www.example.com) - server_name _; + # server_name www.example.com; # Path for static files root /sites/example.com/public; @@ -116,14 +109,12 @@ http { # Static assets location ~* ^.+\.(manifest|appcache)$ { expires -1; - root /sites/example.com/public; access_log logs/static.log; } - # Set expires max on static file types + # Set expires max on static file types (make sure you are using cache busting filenames or query params): location ~* ^.+\.(css|js|jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|woff|eot|mp4|ogg|ogv|webm)$ { expires max; - root /sites/example.com/public; access_log off; }