WebP is a new image format created by Google that can be used on your site in place of more traditional image types such .jpg's and .png files.


There are now a number of WordPress plug-ins that allow you to utilise WebP files for you website such as WP-Rocket. However as this is such a new format not all browsers support the new file type. For compatibility reasons you may still want to serve jpg files to users with browsers that don't support the new WebP image type but serve WebP files to those that do. In order for this to work correctly on the Nimbus Hosting platform we've built a feature that lets you both get the benefits of Nginx caching for static which is built into the platform and WP-Rockets WebP feature.


How it works


WP-Rocket's WebP feature works by creating a WebP copy of all the sites images and at the same time maintains a copy of the original .jpg file. This allows browsers that don't support WebP files to load the jpg copy of the images and browsers that do get served the WebP files.


As you may be aware, The Nimbus Hosting platform has a feature that allows you to server static files from Nginx. See the following link for further details:


What web server does the platform use?


Due to this, we have added the following option that allows you to use the WP-Rocket WebP feature work alongside the Nginx caching for static file feature built into the platform. You can find this on your sites configuration page.




What does it do?


Toggling on the WebP support for WordPress option in the platform makes some adjustments to the sites Nginx config as detailed below: 


location ~* ^(/wp-content/.+)\.(png|jpg)$ {
    set $base $1;
    set $webp_uri $base$webp_suffix;
    set $root /sites/storm/websitename/public;
    root $root;
    add_header Vary Accept;
    try_files $webp_uri $uri =404;
}