• Resolved proson1

    (@proson1)


    location ~* .(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
    # expires max;
    # log_not_found off;
    # access_log off;
    #}

    #add webp capablitiy

    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;
    }

    my current nginx configuration looks like the above, the nginx accept webp mime type, but the browser does not server webp, does anyone know why?

    The page I need help with: [log in to see the link]

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

    (@mateuszgbiorczyk)

    Hi @proson1,

    Thank you for your message.

    This configuration has been tested on an nginx server and works correctly. I suppose these settings may not work for your server for some reason. Could you test something for me?

    Please try this configuration again:

    server {
      # ...
    
      location ~ /wp-content/uploads/(?<path>.+)\.(?<ext>jp?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;
      }
    }

    At the moment, I see that you are using a different plugin, so I cannot check if the plugin works or not. Here I attach to you the video from my test: https://youtu.be/m8pPRiTcl5I

    Let me know if it helped you?

Viewing 1 replies (of 1 total)

The topic ‘Nginx Configuration Not Work’ is closed to new replies.