Skip to content

Instantly share code, notes, and snippets.

@mitjafelicijan
Created February 2, 2019 18:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mitjafelicijan/75fe19b2882c92b138e66b7af144b93f to your computer and use it in GitHub Desktop.
Save mitjafelicijan/75fe19b2882c92b138e66b7af144b93f to your computer and use it in GitHub Desktop.
Cache config for Nginx
# nginx ➜ /etc/nginx/sites-available/default
location /static/ {
alias /path-to-static-content/;
autoindex off;
charset utf-8;
gzip on;
gzip_types text/plain application/javascript application/x-javascript text/javascript text/xml text/css;
location ~* \.(ico|gif|jpeg|jpg|png|woff|ttf|otf|svg|woff2|eot)$ {
expires 1y;
add_header Pragma public;
add_header Cache-Control "public";
}
location ~* \.(css|js|txt)$ {
expires 3600s;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment