Created
December 29, 2022 09:29
-
-
Save apsolut/56083293d7c4969ea5a4d7aad7cac73b to your computer and use it in GitHub Desktop.
Additional nginx directives Plesk
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 ~* ^(/.+)\.(jpg|jpeg|jpe|png|gif)$ { | |
add_header Vary Accept; | |
if ($http_accept ~* "webp"){ | |
set $imwebp A; | |
} | |
if (-f $request_filename.webp) { | |
set $imwebp "${imwebp}B"; | |
} | |
if ($imwebp = AB) { | |
rewrite ^(.*) $1.webp; | |
} | |
} | |
location ~* \.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf|x-html|css|xml|js|woff|woff2|ttf|svg|eot)$ { | |
expires 365d; | |
} | |
gzip on; | |
gzip_disable "MSIE [1-6]\\.(?!.*SV1)"; | |
gzip_proxied any; | |
gzip_comp_level 5; | |
gzip_types text/plain text/css application/javascript application/x-javascript text/xml application/xml application/rss+xml text/javascript image/x-icon image/bmp image/svg+xml; | |
gzip_vary on; | |
location ~* \.(blade\.php)$ { | |
deny all; | |
} | |
location ~* composer\.(json|lock)$ { | |
deny all; | |
} | |
location ~* package(-lock)?\.json$ { | |
deny all; | |
} | |
location ~* yarn\.lock$ { | |
deny all; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment