Possible easy solution for webp format

First of all, thanks to the HestiaCP team for giving us this great panel, I’m delighted.

I’m a bit of a newbie and excuse me if it’s okay to open a thread with this.

The point is that I was having problems with wordpress to deliver Webp format with nginx, I had a hard time finding a decent solution. I found one that worked for me but only with a website and I would like to see if what is missing can be completed here.

I was applying what it says here Configure NGINX to transparently serve WebP files when supported - ShortPixel Knowledge Base

and if it worked but I don’t know how to do it so that it applies to my other websites, it also only applies to the one I put inside
set $ root “<< FULL PATH OF wp-content PARENT >>”;
but I have tried several ways and none works for me to replicate in the others.

Could someone help ??
Thanks in advance

1 Like

Make a /etc/nginx/snippet/webp-map.conf
add the following:

map $http_accept $webp_suffix {
default “”;
“~*webp” “.webp”;


include /etc/nginx/snippets/webp-map.conf;

to /etc/nginx/nginx.conf

create new nginx template just copy the one you want to use for wp, and for other sites just copy the template for that site so they don’t get overwritten in updates. add:

location ~* ^.+.(jpeg|png|jpg) {
try_files $uri$webp_suffix $uri =404;

add it above the first location the position matters for some reason. also add a vary header


Please feel free to PM me if you need more details on integrating this.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.