diff --git a/config/nginx.conf b/config/nginx.conf new file mode 100644 index 0000000..a803463 --- /dev/null +++ b/config/nginx.conf @@ -0,0 +1,89 @@ +worker_processes 6; + +error_log /var/log/nginx/nginx_error.log; +#error_log logs/error.log notice; +#error_log logs/error.log info; + +events { + worker_connections 2048; +} + + +http { + include mime.types; + default_type application/octet-stream; + + client_max_body_size 1G; + + sendfile on; + #tcp_nopush on; + + #keepalive_timeout 0; + keepalive_timeout 65; + + gzip on; + server { + server_name gds.mitchelbv.nl; + access_log /var/log/nginx/guus.mitchelbv.nl; + error_log /var/log/nginx/guus.mitchelbv.nl; + + index index.html; + root /srv/http/games; + + location / { + try_files $uri $uri/ =404; + } + + location ~ .+\.(data|symbols\.json)\.br$ { + # Because this file is already pre-compressed on disk, disable the on-demand compression on it. + # Otherwise nginx would attempt double compression. + gzip off; + add_header Content-Encoding br; + default_type application/octet-stream; + } + + # On-disk Brotli-precompressed JavaScript code files: + location ~ .+\.js\.br$ { + gzip off; # Do not attempt dynamic gzip compression on an already compressed file + add_header Content-Encoding br; + default_type application/javascript; + } + + # On-disk Brotli-precompressed WebAssembly files: + location ~ .+\.wasm\.br$ { + gzip off; # Do not attempt dynamic gzip compression on an already compressed file + add_header Content-Encoding br; + # Enable streaming WebAssembly compilation by specifying the correct MIME type for + # Wasm files. + default_type application/wasm; + } + + # On-disk gzip-precompressed data files should be served with compression enabled: + location ~ .+\.(data|symbols\.json)\.gz$ { + gzip off; # Do not attempt dynamic gzip compression on an already compressed file + add_header Content-Encoding gzip; + default_type application/gzip; + } + + # On-disk gzip-precompressed JavaScript code files: + location ~ .+\.js\.gz$ { + gzip off; # Do not attempt dynamic gzip compression on an already compressed file + add_header Content-Encoding gzip; # The correct MIME type here would be application/octet-stream, but due to Safari bug https://bugs.webkit.org/show_bug.cgi?id=247421, it's preferable to use MIME Type application/gzip instead. + default_type application/javascript; + } + + # On-disk gzip-precompressed WebAssembly files: + location ~ .+\.wasm\.gz$ { + gzip off; # Do not attempt dynamic gzip compression on an already compressed file + add_header Content-Encoding gzip; + # Enable streaming WebAssembly compilation by specifying the correct MIME type for + # Wasm files. + default_type application/wasm; + } + + } + types_hash_max_size 1024; + types_hash_bucket_size 128; +} + +