I posted my question at here https://stackoverflow.com/questions/70008602/nginx-rules-for-avif-and-webp-help-please/ and got the Nginx rules to let the browsers load avif or webp as below based on its support.
http {
map $http_accept $webp_suffix {
default "";
"~image/webp" ".webp";
}
map $http_accept $avif_suffix {
default "";
"~image/avif" ".avif";
}
}
server {
# […]
location ~ ^/images/.*\.(png|jpe?g)$ {
add_header Vary Accept;
try_files $uri$avif_suffix$webp_suffix $uri$avif_suffix $uri$webp_suffix $uri =404;
}
}
However, don't know how to add it to wpcommon-php74.conf without the errors.
Could someone please help?
Thanks