Skip to content

Instantly share code, notes, and snippets.

@apsolut
Created December 29, 2022 09:29
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 apsolut/56083293d7c4969ea5a4d7aad7cac73b to your computer and use it in GitHub Desktop.
Save apsolut/56083293d7c4969ea5a4d7aad7cac73b to your computer and use it in GitHub Desktop.
Additional nginx directives Plesk
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