Support » Plugin: Images to WebP » It doesn’t work for nginx server completly

  • Nginx config file doesn’t allow location block to be inserted directly, i have to put inside a server block. The test is successful but i can’t activate the plugin as it always redirects me to the ‘instruction’ page where it says to copy those few lines in the config files.

    I checked the code and it is because the code is basically “if the server is nginx
    wp_die” and the plugin dies there showing the information page only, without activating.

    • This topic was modified 2 months, 2 weeks ago by hellpunch.
    • This topic was modified 2 months, 2 weeks ago by hellpunch.
    • This topic was modified 2 months, 2 weeks ago by hellpunch.
Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author kubiq

    (@kubiq)

    Hi,

    I’ve tested this plugin on Local by Flywheel NGiNX and also on Finland server with NGiNX and everything works, but NGiNX is much more complicated then Apache, so yes, sometimes there is very specific configuration.

    You should ask your developer for help, or you can write your request on support.kubiq.sk

    Well… i am my developer. Just very very un experienced. I just disregarded the wp_die check control, removing the part of code there to show me the instructions and activated the plugin. it works but the image are still not loaded with webp format but the conversion through imagick is successful. Sigh. But that is not this plugin fault, it is this nginx configuration that doesn’t seem to work properly. I have tried many plugins without the cdn option but that would change webp locally according to http request but none seem to work. Thanks for the reply.

    • This reply was modified 2 months, 2 weeks ago by hellpunch.
    • This reply was modified 2 months, 2 weeks ago by hellpunch.
    • This reply was modified 2 months, 2 weeks ago by hellpunch.
    • This reply was modified 2 months, 2 weeks ago by hellpunch.
    Plugin Author kubiq

    (@kubiq)

    Well yes, that wp_die will run only when the webp is not loaded properly – that’s the point of that testing file… so removing it makes no sense, because yes, then you can activate the plugin, but it will not work.
    When you want to use CDN then you don’t need any plugin, as all popular CDNs have their own image processing and WebP delivery mechanism.
    Or you can use only CDN for images, something like https://wordpress.org/plugins/auto-cloudinary/

    But i copied exactly the code the instruction gave me. Just that you can’t add a location block directly to the nginx conf file.

    so goes like

    map $http_accept $webp_suffix {

    }
    server {
    location ~* ^/wp-content/.+\.(png|gif|jpe?g)$ {
    …..
    }
    }

    or in the server block inside the sub folder.

    What does CURLINFO_SIZE_DOWNLOAD > 100 check exactly?

    • This reply was modified 2 months, 2 weeks ago by hellpunch.
    • This reply was modified 2 months, 2 weeks ago by hellpunch.
    • This reply was modified 2 months, 2 weeks ago by hellpunch.
    • This reply was modified 2 months, 2 weeks ago by hellpunch.
    • This reply was modified 2 months, 2 weeks ago by hellpunch.
    Plugin Author kubiq

    (@kubiq)

    For example on Local by Flywheel, you should add

    map $http_accept $webp_suffix {
    	default "";
    	"~*webp" ".webp";
    }

    to /conf/nginx/nginx.conf.hbs somewhere before/after other maps

    and then add

    location ~* ^/wp-content/.+\.(png|gif|jpe?g)$ {
    	add_header Vary Accept;
    	try_files $uri$webp_suffix $uri =404;
    }

    to /conf/nginx/site.conf.hbs somewhere before/after other locations

    and the most important thing is TO RESTART YOUR SERVER

    then you can activate the plugin and everything works – just tested right now šŸ˜‰

    Again, doesn’t work.

    The code checks if CURLINFO_SIZE_DOWNLOAD is > 100 and then kills the plugin activation with wp_die if that condition is true. I print out $filesize and it shows me “435”.

    • This reply was modified 2 months, 2 weeks ago by hellpunch.
    Plugin Author kubiq

    (@kubiq)

    So then answer is easy – your server doesn’t support WebP.

    What does that even mean, how is that gd and imagick show webp enabled when my server shouldn’t support it then?

    Plugin Author kubiq

    (@kubiq)

    You need to communicate with your hosting provider or someone who has access to your server and is more experienced

    I can not help you more from here

    Good luck

Viewing 9 replies - 1 through 9 (of 9 total)
  • You must be logged in to reply to this review.