Skip to content

Commit

Permalink
fix: add nginx support for webp images in hidden directory, sync ngin…
Browse files Browse the repository at this point in the history
…x conf (ddev#5580) [skip ci]

Co-authored-by: Stanislav Zhuk <[email protected]>
  • Loading branch information
stephanie-ehrling and stasadev authored Mar 5, 2024
1 parent 792611b commit 22df941
Show file tree
Hide file tree
Showing 15 changed files with 36 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ server {
}

# Media: images, icons, video, audio, HTC
location ~* \.(png|jpg|jpeg|gif|ico|svg)$ {
location ~* \.(jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|webp|htc)$ {
try_files $uri @rewrite;
expires max;
log_not_found off;
Expand Down
9 changes: 9 additions & 0 deletions pkg/ddevapp/webserver_config_assets/nginx-site-craftcms.conf
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ server {
fastcgi_param HTTPS $fcgi_https;
}

# Expire rules for static content

# Media: images, icons, video, audio, HTC
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|webp|htc)$ {
expires 1M;
access_log off;
add_header Cache-Control "public";
}

# Prevent clients from accessing hidden files (starting with a dot)
# This is particularly important if you store .htpasswd files in the site hierarchy
# Access to `/.well-known/` is allowed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ server {
}

# Media: images, icons, video, audio, HTC
location ~* \.(png|jpg|jpeg|gif|ico|svg)$ {
location ~* \.(jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|webp|htc)$ {
try_files $uri @rewrite;
expires max;
log_not_found off;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ server {
# Expire rules for static content

# Media: images, icons, video, audio, HTC
location ~* \.(png|jpg|jpeg|gif|ico|svg)$ {
location ~* \.(jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|webp|htc)$ {
try_files $uri @rewrite;
expires max;
log_not_found off;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ server {
# Expire rules for static content

# Media: images, icons, video, audio, HTC
location ~* \.(png|jpg|jpeg|gif|ico|svg)$ {
location ~* \.(jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|webp|htc)$ {
try_files $uri @rewrite;
expires max;
log_not_found off;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ server {
}

# Media: images, icons, video, audio, HTC
location ~* \.(png|jpg|jpeg|gif|ico|svg)$ {
location ~* \.(jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|webp|htc)$ {
try_files $uri @rewrite;
expires max;
log_not_found off;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ server {
}

# Media: images, icons, video, audio, HTC
location ~* \.(png|jpg|jpeg|gif|ico|svg)$ {
location ~* \.(jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|webp|htc)$ {
try_files $uri @rewrite;
expires max;
log_not_found off;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ server {
# Expire rules for static content

# Media: images, icons, video, audio, HTC
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|webp|htc)$ {
expires 1M;
access_log off;
add_header Cache-Control "public";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ server {
# Expire rules for static content

# Media: images, icons, video, audio, HTC
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|webp|htc)$ {
expires 1M;
access_log off;
add_header Cache-Control "public";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ server {
# Expire rules for static content

# Media: images, icons, video, audio, HTC
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|webp|htc)$ {
expires 1M;
access_log off;
add_header Cache-Control "public";
Expand Down
9 changes: 9 additions & 0 deletions pkg/ddevapp/webserver_config_assets/nginx-site-php.conf
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ server {
fastcgi_param HTTPS $fcgi_https;
}

# Expire rules for static content

# Media: images, icons, video, audio, HTC
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|webp|htc)$ {
expires 1M;
access_log off;
add_header Cache-Control "public";
}

# Prevent clients from accessing hidden files (starting with a dot)
# This is particularly important if you store .htpasswd files in the site hierarchy
# Access to `/.well-known/` is allowed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ server {
# Expire rules for static content

# Media: images, icons, video, audio, HTC
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|webp|htc)$ {
expires 1M;
access_log off;
add_header Cache-Control "public";
Expand Down
6 changes: 3 additions & 3 deletions pkg/ddevapp/webserver_config_assets/nginx-site-typo3.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

# Support for WebP
map $http_accept $webp_suffix {
default "";
"~*webp" ".webp";
default "";
"~*webp" ".webp";
}

server {
Expand Down Expand Up @@ -88,7 +88,7 @@ server {
# Expire rules for static content

# Media: images, icons, video, audio, HTC
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|webp|htc)$ {
expires 1M;
access_log off;
add_header Cache-Control "public";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ server {
fastcgi_param HTTPS $fcgi_https;
}

location ~* \.(png|jpg|jpeg|gif|ico)$ {
# Expire rules for static content

# Media: images, icons, video, audio, HTC
location ~* \.(jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|webp|htc)$ {
expires max;
log_not_found off;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ server {

# Expire rules for static content
# Media: images, icons, video, audio, HTC
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|webp|htc)$ {
expires 1M;
access_log off;
add_header Cache-Control "public";
Expand Down

0 comments on commit 22df941

Please sign in to comment.