To understand why this setup is not secure, please have look at:
https://www.breachattack.com/
The gzip permissions are quite broad and unrestriced for maxium performance inside a small LAN where bad WLAN connections can introduce all kinds of problems.
If you want make things more secure, you can add these settings to the SSL configuration block:
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
ssl_prefer_server_ciphers on;
If you also want securtiy headers added, these would looke like this in the same server block:
# Security headers
add_header Strict-Transport-Security "max-age=63072000" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Permissions-Policy "camera=(self), microphone=(self), geolocation=()" always;
also more restrice gzip settings with more explicit file blocking could looke like this:
# Compression settings
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/javascript application/json application/octet-stream image/svg+xml;
# Increase upload size limit
client_max_body_size 25M;
# Block access to sensitive files
location ~* /\.(env|git|svn|ht|DS_Store|aws|dockerignore|npmrc|gitignore|env.*|bak|backup|swp|swo|idea|vscode|log|sql|yml|yaml|xml|ini|php|json)$ {
deny all;
return 403;
}
location ~* /(composer\.json|package\.json|yarn\.lock|Dockerfile|docker-compose\.yml|docker-compose\.yaml|Makefile|Procfile|config\.js|config\.ts|tsconfig\.json|jsconfig\.json|webpack\.config\.js|babel\.config\.js|Gruntfile\.js|gulpfile\.js|\.well-known/security.txt)$ {
deny all;
return 403;
}