43 lines
1.0 KiB
Plaintext
43 lines
1.0 KiB
Plaintext
map $http_accept $webp_suffix { "~*webp" ".webp" };
|
|
types {
|
|
image/webp webp;
|
|
}
|
|
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
server_name localhost;
|
|
|
|
#access_log /var/log/nginx/host.access.log main;
|
|
|
|
location / {
|
|
root /usr/share/nginx/html;
|
|
index index.html index.htm;
|
|
expires 1y;
|
|
etag off;
|
|
if_modified_since off;
|
|
add_header Cache-Control "public, no-transform";
|
|
}
|
|
|
|
location ~* \.(?:png|jpe?g)(\?.+)?$ {
|
|
try_files $uri$webp_suffix $uri =404;
|
|
}
|
|
|
|
error_page 404 /404.html;
|
|
location = /404.html {
|
|
root /usr/share/nginx/html;
|
|
}
|
|
|
|
|
|
# redirect server error pages to the static page /50x.html
|
|
#
|
|
#error_page 500 502 503 504 /50x.html;
|
|
#location = /50x.html {
|
|
# root /usr/share/nginx/html;
|
|
#}
|
|
|
|
gzip on;
|
|
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;
|
|
|
|
} |