This commit is contained in:
@ -1,3 +1,20 @@
|
|||||||
|
# Map to check if client is capable of handling webp
|
||||||
|
map $http_accept $webp_suffix {
|
||||||
|
default "";
|
||||||
|
"~*webp" ".webp"; # Sets suffix to .webp if Accept header contains webp
|
||||||
|
}
|
||||||
|
|
||||||
|
# Map to capture the image path *without* the file extension
|
||||||
|
# This regex captures everything before the last dot and jpg/jpeg/png extension
|
||||||
|
map $uri $image_path_without_ext {
|
||||||
|
~^(?<captured_path>.+)\.(?:jpe?g|png)$ $captured_path;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
listen [::]:80;
|
||||||
|
server_name localhost; # Replace localhost with your actual domain if needed
|
||||||
|
|
||||||
# Define the root directory for your website files
|
# Define the root directory for your website files
|
||||||
root /usr/share/nginx/html;
|
root /usr/share/nginx/html;
|
||||||
|
|
||||||
@ -41,3 +58,4 @@ location = /50x.html {
|
|||||||
gzip on;
|
gzip on;
|
||||||
gzip_comp_level 4;
|
gzip_comp_level 4;
|
||||||
gzip_types text/html text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
|
gzip_types text/html text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
|
||||||
|
}
|
Reference in New Issue
Block a user