Question

I feel so dumb asking this

Posted December 10, 2020 511 views
Nginx

I am new to the whole NGINX server so please ignore my complete ignorance.

I use spinupwp with Digital Ocean because I wanted to test out some of our SEO clients on something that wasn’t apache. I have searched high and low, tried going in through Putty, tried going in through sftp, and the console.

I’ve logged in with the root user tried getting to the /etc/nginx/sites-available/ so I can get to it and nothing. It’s like it isn’t even there. So maybe I set something up wrong.

I need to insert the following in the server context of your configuration file so I can serve my images as webp can someone please just point me in the right direction or let me know if I am even close looking in the places I am looking. Ugh I feel like such a newb and that it’s right in front of me and I am just completely missing it.

# BEGIN SMUSH-WEBP
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;
}
# END SMUSH-WEBP

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.

×
Submit an Answer
1 answer

Hey there @MekaPika,

What is the Linux distribution that you are using?

For example, if you are using Nginx, your Nginx server blocks would be in /etc/nginx/conf.d rather than the sites-enabled folder as with Ubuntu servers. Files that end with .conf in that directory will be loaded when Nginx is started.

Also, don’t be afraid to ask! We are a friendly community!

Regards,
Bobby