Support » Plugin: WebP Converter for Media » Nginx

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    Hi @wordonpress,

    Thank you for your message. Yes, I have settings to configure nginx.

    Please edit the configuration file:
    /etc/nginx/mime.types

    and add this code:

    types {
      # ...
    
      image/webp webp;
    }

    Then please find your configuration file in the path (default is default file):
    /etc/nginx/sites-available/

    and add below code in this file:

    server {
      # ...
    
      location ~ (?<root>.+)/uploads/(?<path>.+)\.(?<ext>jp?g|png|gif)$ {
        if ($http_accept !~* "image/webp") {
          break;
        }
        add_header Vary Accept;
        expires 365d;
        try_files $root/uploads-webpc/$path.$ext.webp $uri =404;
      }
    }

    Let me know if it works for you. I will be grateful for feedback!

    Thread Starter wordonpress

    (@wordonpress)

    Works fine! Thanks)

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    @wordonpress, I am happy to.

    In that case, can I ask you to add a review? I will be very grateful!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Nginx’ is closed to new replies.