Support » Plugin: WebP Converter for Media » NGINX Rules WP Engine

  • Resolved Rafael

    (@rafafalk)


    Hi,

    I received this error message in WP:

    Server configuration error
    Redirects on your server are not working. Check the correct configuration for you in the plugin FAQ. If your configuration is correct, it means that your server does not support redirects from the .htaccess file or requests to images are processed by your server bypassing Apache. In this case, please contact your server administrator.

    I already contacted the WP Engine hosting support and they asked NGINX Rules, I already sent the rules on the FAQ but they request:

    “a more custom descriptive NGINX code for my specific issue.”

    Can you provide that NGINX Rules?

    Thanks in advance

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

Viewing 8 replies - 1 through 8 (of 8 total)
  • server configuration

    https://ibb.co/0G9ZC5x

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    Hi @rafafalk,

    Thank you for your message.

    The configuration given in the FAQ is complete. It should be run on the server.

    Hi @mateuszgbiorczyk

    Today I have installed the plugin and was not able to use it due to error.

    My environment is ubuntu 20 + ngnix 1.18.0. (No customization to nginx has done) I made the changes to nginx server which you have given in the FAQ. Still am getting the below error. I read most the support thread, still was not able to solve the issue.

    Thanks for your time. Below is the error message

    ——————————————————————————–
    Server configuration error

    Redirects on your server are not working. Check the correct configuration ……
    ———————————————————————————-

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    @jihadaj, unfortunately, I am not able to help you more. I have no idea why this setup is not working on your server. The configuration is correct, but maybe it needs to be configured additionally for your server.

    @mateuszgbiorczyk Thanks for your response. Highly appriciated.

    Could you kindly share your test environment’s ngnix configuration file (ngnix.conf) and site configuration file. I will do a step by step comparison with mine. Hope that will solve the issue.

    Regards,

    Jihad

    At NGINX source exemplo there is a ‘mistake’ in path folder. Double check if the source location is right to your WP instalation, form me I just added the folder ‘uploads’ and than it work like a charme.

    location ~ /wp-content/uploads/(?<path>.+)\.(?<ext>jpe?g|png|gif)$ {
            if ($http_accept !~* "image/webp") {
                break;
            }
            add_header Vary Accept;
            expires 365d;
            try_files /wp-content/uploads-webpc/uploads/$path.$ext.webp $uri =404;
        }

    Thanks for the great plugin!

    @souzadavi @mateuszgbiorczyk

    Hello,

    I made the above change suggested by @souzadavi still am getting the same error,so i reverted to the previous configuration. Below am pasting my current confg/logs

    ———————————————————————————
    From the nginx access.log
    ——————————————————————————-
    GET /wp-content/uploads/webp-converter-for-media-test.png2 HTTP/2.0″ 200
    21586 “https://xxxxxxxxxxxx/wp-content/plugins/webp-converter-for-media/&#8221; “-”

    No information in the nginx error.log

    From debug.log

    WebP Converter for Media: Image “/var/www/html//wp-content/uploads/2020/07/facebook_profile_image.png” converted to WebP is larger than original and has been deleted.

    —————————————————————————
    From configuration file

    location ~ /wp-content/(?<path>.+)\.(?<ext>jpe?g|png|gif)$ {
    if ($http_accept !~* “image/webp”) {
    break;
    }
    add_header Vary Accept;
    expires 365d;
    try_files /wp-content/uploads-webpc/uploads/$path.$ext.webp $uri =404;
    }
    location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;

    }
    ————————————————————–

    • This reply was modified 3 months, 2 weeks ago by jihadaj.
    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    @rafafalk and @jihadaj, I checked the configuration for the Nginx server again. I set up a new server and did the entire procedure using these instructions. I was able to run WordPress and installed my plugin.

    Then I received a error message in plugin settings that redirects are not working. This is normal as Nginx requires manual configuration. Then I did the configuration settings for the plugin and everything works. The error is gone and the pictures are displayed in WebP.

    I updated the “Configuration for Nginx” question in the plugin FAQ. I have added some information there that you should pay attention to. The configuration itself works as it was.

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