Skip to content

Instantly share code, notes, and snippets.

@wilmardo
Created March 21, 2020 13:23
Show Gist options
  • Save wilmardo/dc1a8c33b4adbf32aaacc96cef4572e7 to your computer and use it in GitHub Desktop.
Save wilmardo/dc1a8c33b4adbf32aaacc96cef4572e7 to your computer and use it in GitHub Desktop.
server {
listen 8080 default_server;
server_name 0.0.0.;
root /var/www/html;
index index.html index.htm;
location / {
try_files $uri $uri/ =404;
}
# Enable gzip
gzip_static on;
# Enable looking for .br files
brotli_static on;
# Expire rules for static content
# cache.appcache, your document html and data
location ~* \.(?:manifest|appcache|html?|xml|json)$ {
expires -1;
}
# Feed
location ~* \.(?:rss|atom)$ {
expires 1h;
add_header Cache-Control "public";
}
# Media: images, icons, video, audio, HTC
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
expires 1M;
access_log off;
add_header Cache-Control "public";
}
# CSS and Javascript
location ~* \.(?:css|js)$ {
expires 1y;
access_log off;
add_header Cache-Control "public";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment