Created
December 3, 2018 13:38
-
-
Save aprakasa/4409b11128651214db40e0fdd619bb0d to your computer and use it in GitHub Desktop.
Nginx expire headers
This file contains 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
location ~* \.(?:css|js|txt)$ { | |
expires 1M; | |
sendfile on; | |
tcp_nopush on; | |
tcp_nodelay off; | |
add_header Cache-Control "public"; | |
} | |
location ~* \.(?:json|xml|rss|atom)$ { | |
expires 1h; | |
sendfile on; | |
tcp_nopush on; | |
tcp_nodelay off; | |
add_header Cache-Control "public"; | |
} | |
location ~* \.(?:ttf|ttc|otf|eot|woff|woff2)$ { | |
expires 3M; | |
sendfile on; | |
tcp_nopush on; | |
tcp_nodelay off; | |
add_header Cache-Control "public"; | |
} | |
#Media: images, icons, video, audio, HTC | |
location ~* \.(?:jpg|jpeg|webp|gif|png|ico|cur|zip|tgz|gz|rar|bz2|tar|svg|svgz|mp4|ogg|ogv|webm|mid|midi|wav|bmp|rtf|htc)$ { | |
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