Created
February 2, 2019 18:33
-
-
Save mitjafelicijan/75fe19b2882c92b138e66b7af144b93f to your computer and use it in GitHub Desktop.
Cache config for Nginx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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