38 lines
870 B
Plaintext
38 lines
870 B
Plaintext
map $http_accept $webp_suffix {
|
|
default "";
|
|
"~*webp" ".webp";
|
|
}
|
|
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
server_name localhost;
|
|
|
|
location ~* \.(?:jpg|jpeg|png|webp)$ {
|
|
root /usr/share/nginx/html;
|
|
try_files $uri$webp_suffix $uri = 404;
|
|
}
|
|
|
|
location / {
|
|
root /usr/share/nginx/html;
|
|
index index.html index.htm;
|
|
}
|
|
|
|
error_page 404 500 502 503 504 /404.html;
|
|
location = /404.html {
|
|
root /usr/share/nginx/html;
|
|
}
|
|
|
|
# Caching headers
|
|
# location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
|
|
# expires 30d;
|
|
# add_header Pragma public;
|
|
# add_header Cache-Control "public";
|
|
# }
|
|
|
|
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;
|
|
|
|
}
|