From 4eeed482eebac340eb8ac1649d9eb79a5b076266 Mon Sep 17 00:00:00 2001 From: Tanishq Dubey Date: Fri, 14 Jul 2023 23:50:02 -0400 Subject: [PATCH] nginx options --- config/nginx.conf | 85 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 84 insertions(+), 1 deletion(-) diff --git a/config/nginx.conf b/config/nginx.conf index 87b6856..5987485 100644 --- a/config/nginx.conf +++ b/config/nginx.conf @@ -16,17 +16,98 @@ http { '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; - access_log /var/log/nginx/access.log main; + access_log /var/log/nginx/access.log main buffer=16k;; sendfile on; tcp_nopush on; tcp_nodelay on; + client_body_buffer_size 80k; + client_max_body_size 9m; + client_header_buffer_size 1k; + + client_body_timeout 10; + client_header_timeout 10; + keepalive_timeout 13; + send_timeout 10; + + open_file_cache max=1024 inactive=10s; + open_file_cache_valid 60s; + open_file_cache_min_uses 2; + open_file_cache_errors on; + keepalive_timeout 65; + add_header Timing-Allow-Origin "*"; + add_header X-Content-Type-Options nosniff always; + + default_type application/octet-stream; + gzip on; gzip_disable "msie6"; + # Compression level (1-9). + # 5 is a perfect compromise between size and CPU usage, offering about 75% + # reduction for most ASCII files (almost identical to level 9). + # Default: 1 + gzip_comp_level 5; + + # Don't compress anything that's already small and unlikely to shrink much if at + # all (the default is 20 bytes, which is bad as that usually leads to larger + # files after gzipping). + # Default: 20 + gzip_min_length 256; + + # Compress data even for clients that are connecting to us via proxies, + # identified by the "Via" header (required for CloudFront). + # Default: off + gzip_proxied any; + + # Tell proxies to cache both the gzipped and regular version of a resource + # whenever the client's Accept-Encoding capabilities header varies; + # Avoids the issue where a non-gzip capable client (which is extremely rare + # today) would display gibberish if their proxy gave them the gzipped version. + # Default: off + gzip_vary on; + + # Compress all output labeled with one of the following MIME-types. + # `text/html` is always compressed by gzip module. + # Default: text/html + gzip_types + application/atom+xml + application/geo+json + application/javascript + application/x-javascript + application/json + application/ld+json + application/manifest+json + application/rdf+xml + application/rss+xml + application/vnd.ms-fontobject + application/wasm + application/x-web-app-manifest+json + application/xhtml+xml + application/xml + font/eot + font/otf + font/ttf + image/bmp + image/svg+xml + image/vnd.microsoft.icon + image/x-icon + text/cache-manifest + text/calendar + text/css + text/javascript + text/markdown + text/plain + text/xml + text/vcard + text/vnd.rim.location.xloc + text/vtt + text/x-component + text/x-cross-domain-policy; + server { listen 80; server_name sesame.dws.rip; @@ -37,5 +118,7 @@ http { location / { try_files $uri $uri/ /index.html; } + + location ~* .(jpg|jpeg|png|gif|ico|css|js)$ {expires 30d;} } }