Fork me on GitHub
X

WordPress-kehittäjä, älä missaa ilmaista webinaariamme Xdebugista elokuun 19. päivä!

WordPress-utvecklare, missa inte vår kostnadsfria webbinar om Xdebug den 19. augusti!

WordPress developer, don't miss our free webinar about Xdebug on August 19th!

One way to serve images in WebP format is by using the WebP Converter for Media plugin.

In addition to installing and activating the plugin some additional configuration for NGINX is required.

Create a file webp.conf inside the folder /data/wordpress/nginx and copy this configuration inside it:

# NGINX config for WebP Converter for media
# https://wordpress.org/plugins/webp-converter-for-media/
location ~ /wp-content/(?<path>.+)\.(?<ext>jpe?g|png|gif)$ {
  if ($http_accept !~* "image/webp") {
    break;
  }
  add_header Vary Accept;
  expires 365d;
  try_files /wp-content/uploads-webpc/$path.$ext.webp $uri =404;
}

REMEMBER! NGINX has to be restarted after adding a config file. Run command wp-restart-nginx to restart.

You can now continue with the plugin setup.