diff --git a/files/nginx.conf b/files/nginx.conf index 0f134fa..96f6873 100644 --- a/files/nginx.conf +++ b/files/nginx.conf @@ -20,7 +20,17 @@ http { access_log /var/log/nginx/access.log main; sendfile on; - #tcp_nopush on; + send_timeout 3600; + tcp_nopush on; + tcp_nodelay on; + + open_file_cache max=500 inactive=10m; + open_file_cache_errors on; + reset_timedout_connection on; + + set_real_ip_from revproxy; + real_ip_header X-Forwarded-For; + real_ip_recursive on; # Prevent nginx HTTP Server Detection server_tokens off; @@ -46,7 +56,21 @@ http { # set max upload size client_max_body_size 512M; - fastcgi_buffers 64 4K; + + # Do not limit download file size (default: 1G) + fastcgi_max_temp_file_size 0; + + #fastcgi_buffers 64 4K; + fastcgi_buffers 64 64K; + fastcgi_buffer_size 256k; + fastcgi_busy_buffers_size 3840K; + fastcgi_read_timeout 3600; + fastcgi_send_timeout 3600; + fastcgi_connect_timeout 3600; + fastcgi_cache_key $http_cookie$request_method$host$request_uri; + fastcgi_cache_use_stale error timeout invalid_header http_500; + fastcgi_ignore_headers Cache-Control Expires Set-Cookie; + # Enable gzip but do not remove ETag headers gzip on; @@ -55,6 +79,7 @@ http { gzip_min_length 256; gzip_proxied expired no-cache no-store private no_last_modified no_etag auth; gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy; + gzip_disable "MSIE [1-6]\." # Pagespeed is not supported by Nextcloud, so if your server is built # with the `ngx_pagespeed` module, uncomment this line to disable it. @@ -142,6 +167,11 @@ http { fastcgi_param modHeadersAvailable true; # Avoid sending the security headers twice fastcgi_param front_controller_active true; # Enable pretty urls + + fastcgi_cache_valid 404 1m; + fastcgi_cache_valid any 1h; + fastcgi_cache_methods GET HEAD; + fastcgi_pass php-handler; fastcgi_intercept_errors on;