Last active
June 8, 2019 17:39
-
-
Save KevinBatdorf/3f530483ef5485e0211a2cdcf77e2bd8 to your computer and use it in GitHub Desktop.
nginx webp express + expires to add to an existing nginx config
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
# There is a lot of stuff before here | |
location ~* \.(css|js|ico|gif|webp|svg|eot|otf|woff|woff2|ttf|ogg)$ { | |
expires 365d; | |
} | |
location ~* ^/?content/.*\.(png|jpe?g)$ { | |
add_header Vary Accept; | |
expires 365d; | |
if ($http_accept !~* "webp") { | |
break; | |
} | |
try_files | |
$uri.webp | |
/content/plugins/webp-express/wod/webp-on-demand.php?xsource=x$request_filename&wp-content=content | |
; | |
} | |
location ~* ^/?content/.*\.(png|jpe?g)\.webp$ { | |
try_files | |
$uri | |
/content/plugins/webp-express/wod/webp-realizer.php?wp-content=content | |
; | |
} | |
location ~* \.(pdf)$ { | |
expires 30d; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment