I am new to the whole NGINX server so please ignore my complete ignorance.
I need to insert the following in the server context of blocks would be in /etc/nginx/conf.d/wordpress.conf
so I can serve my images as webp can someone please just let me know how it should be. Ugh I feel like such a newb and that it’s right in front of me and I am just completely missing it.
location ~* "wp-content\/(uploads\/)(.*.(?:png|jpe?g))" {
add_header Vary Accept;
set $image_path $2;
if (-f "/sites/plastiwin.com/files/wp-content/smush-webp/disable_smush_webp") {
break;
}
if ($http_accept !~* "webp") {
break;
}
try_files /wp-content/smush-webp/$image_path.webp $uri =404;
}
But I think I’m doing something wrong т-т.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hi @markinfinet,
In order to make your configuration work, you need to create the config file for your website plastiwin.com in
/etc/nginx/sites-enabled/
.You can check this tutorial on STEP 5 to see how usually the config file is created: