diff --git a/conf/nginx/nginx.conf b/conf/nginx/nginx.conf new file mode 100644 index 0000000..736dcc7 --- /dev/null +++ b/conf/nginx/nginx.conf @@ -0,0 +1,84 @@ +charset utf-8; + +# Block access to hidden files +location ~ /\. { + deny all; +} + +# Block access to sensitive files +location ~ \.(bak|conf|dist|fla|in[ci]|log|old|sh|sql|sw[op])|~$ { + deny all; +} + +# MIME types +types { + application/atom+xml atom; + application/json json map topojson; + application/ld+json jsonld; + application/rss+xml rss; + application/vnd.geo+json geojson; + application/xml rdf xml; + application/javascript js; + application/manifest+json webmanifest; + application/x-web-app-manifest+json webapp; + text/cache-manifest appcache; + audio/mp4 f4a f4b m4a; + audio/ogg oga ogg opus; + image/bmp bmp; + image/svg+xml svg svgz; + image/webp webp; + video/mp4 f4v f4p m4v mp4; + video/ogg ogv; + video/webm webm; + video/x-flv flv; + image/x-icon cur ico; + application/font-woff woff; + application/font-woff2 woff2; + application/vnd.ms-fontobject eot; + application/x-font-ttf ttc ttf; + font/opentype otf; + application/octet-stream safariextz; + application/x-bb-appworld bbaw; + application/x-chrome-extension crx; + application/x-opera-extension oex; + application/x-xpinstall xpi; + text/vcard vcard vcf; + text/vnd.rim.location.xloc xloc; + text/vtt vtt; + text/x-component htc; +} + +# Compression +gzip on; +gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rdf+xml application/rss+xml application/schema+json application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-javascript application/x-web-app-manifest+json application/xhtml+xml application/xml font/eot font/opentype image/bmp image/svg+xml image/vnd.microsoft.icon image/x-icon text/cache-manifest text/css text/html text/javascript text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy text/xml; + +# Headers +add_header X-UA-Compatible "IE=edge"; +add_header X-Content-Type-Options nosniff; +etag off; +server_tokens off; + +# Autoindex off +autoindex off; + +# Error pages +error_page 404 /404.html; + +# Expires +location ~* \.(css|js|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|bmp|svgz|webp|f4a|f4b|m4a|oga|ogg|opus|ogv|webm|flv|cur|ico|woff|woff2|eot|ttc|ttf|otf|safariextz|bbaw|crx|oex|xpi|vcard|vcf|xloc|vtt|htc)$ { + expires 1y; + add_header Cache-Control "public, immutable"; +} + +location ~* \.(json|ld\+json|xml|pdf|webmanifest|appcache|atom|rss|geojson)$ { + expires 0; +} + +location ~* \.(html)$ { + expires 0; +} + +# Main location +location / { + try_files $uri $uri/ /index.php?$query_string; +} \ No newline at end of file