Support » Plugin: WebP Converter for Media » Nginx conf

  • Resolved volatilparis

    (@volatilparis)


    Hello,

    I think nginx do not read .htaccess, so the webp image aren’t loaded.

    Would you please send the rewrite & cache block for nginx ?

    Thanks,

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

    (@mateuszgbiorczyk)

    Hi @moemos,

    Thank you very much 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!

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    Hi @volatilparis,

    Hello, did you manage to solve your problem? Can I ask you for some comment on your case?

    The answer from you is very important to me so that my technical support can be improved.

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