• Resolved keniry

    (@keniry)


    Hello, I hope you can help as I want to use your plugin on my spinupwp servers which run nginx.

    my test site is https://astrabb.mull.pro

    currently I cannot get past the server configuration error Redirects on your server are not working.

    As I am fairly useless with nginx or apache for that matter I checked with spinupwp support and sent your FAQ nginx config link.

    The comment was…

    Based on a quick view of the link you’ve sent I would recommend adding a new .conf file to the following directory:

    /etc/nginx/sites-available/{domain}/server/webp.conf (or whatever you’d like to name the file besides webp)

    This will get imported into the sites server block in the main nginx conf.

    They added that they do not normally support this sort of custom change so I am hoping we can arrive at another solution.

    anyway I created like this

    
    $ cat /etc/nginx/sites-available/astrabb.mull.pro/server/webp.conf
     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/$path.$ext.webp $uri =404;
        } 

    mime.types

    
    $ cat /etc/nginx/mime.types
    
    /../
        image/png                             png;
        image/tiff                            tif tiff;
        image/vnd.wap.wbmp                    wbmp;
        image/x-icon                          ico;
        image/x-jng                           jng;
        image/x-ms-bmp                        bmp;
        image/svg+xml                         svg svgz;
        image/webp                            webp;
    
    

    I also tried the latest beta plugin 1.4.3 indicated in the recent post on not installing htaccess for nginx.

    https://spinupwp.com/doc/changing-nginx-settings/ might give you some idea but I ran up a server purely to test your plugin – its all test nothing live

    …rather than fill this forum I can send you anything you need.

    thanks

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

Viewing 15 replies - 1 through 15 (of 18 total)
  • Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    Hi @keniry,

    Thanks for your message.

    Please see the plugin’s FAQ. There you will find the correct configuration for the Nginx server. Your configuration is out of date.

    Thread Starter keniry

    (@keniry)

    i read the faq

    Thread Starter keniry

    (@keniry)

    Have you heard of specific hyperlinks – they can be useful here,

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    @keniry read my message again. I gave you a solution to your problem:

    Please see the plugin’s FAQ. There you will find the correct configuration for the Nginx server. Your configuration is out of date.

    Thread Starter keniry

    (@keniry)

    @mateuszgbiorczyk Dear Mateusz, thank you so much for sending a such a thoughtful detailed and specific solution configuration is out of date but alas I have no idea what you mean by my since it was copy and pasted from the FAQ link you often paste into this forum.

    As explained previously I am not a nginx expert but I did read the FAQ over and over again and I raised a ticket with my host support who explained in detail as I previously typed:

    Based on a quick view of the link you’ve sent I would recommend adding a new .conf file to the following directory:

    /etc/nginx/sites-available/{domain}/server/webp.conf (or whatever you’d like to name the file besides webp)

    This will get imported into the sites server block in the main nginx conf.

    So I followed your FAQ and their advice I added your sample server directive block from the FAQ but as you would probably guess if I include the server directive

    `$ sudo nginx -t
    nginx: [emerg] “server” directive is not allowed here in /etc/nginx/sites-available/astrabb.mull.pro/server/webp.conf:1

    so I removed the server outer block and I get no error nginx starts OK but the original dashboard error message remains:

    Redirects on your server are not working.

    thank you

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    Please compare your configuration in the first post with the one now in the FAQ. Do you see the difference?

    Thread Starter keniry

    (@keniry)

    yes

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    Then you know what to improve ??

    Thread Starter keniry

    (@keniry)

    I tried this plugin on two server platforms, easywp and spinupwp; in both cases I could not get past the admin dashboard error.

    server configuration error Redirects on your server are not working.

    I dont think there is anything too special in the way my server is configured but I followed the FAQ and as suggested in the FAQ got sysadmin advice which was

    Based on a quick view of the link you’ve sent I would recommend adding a new .conf file to the following directory:

    /etc/nginx/sites-available/{domain}/server/webp.conf (or whatever you’d like to name the file besides webp)

    This will get imported into the sites server block in the main nginx conf.

     

    I checked the two config points mentioned the FAQ for this plugin and found mime.types to have already defined of webp but lacking the server / location directive. ?as I dont know much about nginx configuration and I have a test server I tried a few things

    adding the nginx config block as per the FAQ as of sept 21 2020 to a new file /etc/nginx/sites-available/{domain}/server/webp.conf

    FAQ code block

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

    …in a new file as suggested by my support will result in/etc/nginx/sites-available/{domain}/server/webp.conf

    after killing nginx the first time I learnt its best to run this first and on a test server

    $ sudo nginx -t
    nginx: [emerg] “server” directive is not allowed here in /etc/nginx/sites-available

    I found some explanation of that here:

    https://stackoverflow.com/questions/41766195/nginx-emerg-server-directive-is-not-allowed-here/41766811

    I tried whats seems to be an OLD VERSION from the forum with had the server directive removed

    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/$path.$ext.webp $uri =404;
        } 

    then the NEW VERSION from the FAQ with server directive removed

     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/$path.$ext.webp $uri =404;
      }

    both versions pass nginx -t but neither remove the dashboard error message

    server configuration error Redirects on your server are not working

    I leave it there as reading further CDN seems to be not supported by this plugin. I hope somene finds this useful.

    update: the code block segments in this post are tricky to format – trying again

    • This reply was modified 4 years, 6 months ago by keniry.
    • This reply was modified 4 years, 6 months ago by keniry.
    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    @keniry If you want, add the following code to the functions.php file in your theme:

    add_filter('webpc_server_errors', function($errors)
    {
      if (isset($errors['rewrites_not_working'])) {
        unset($errors['rewrites_not_working']);
      }
      return $errors;
    });

    This will hide this error. Then check the plugin operation.

    Thread Starter keniry

    (@keniry)

    @mateuszgbiorczyk sorry I don’t have a lot of time today but I quickly checked the nginx config again; I added the code using the code snippets plugin.. which did see the error message go away and allow the force convert all images to run using the beta plugin Version 1.4.2 – it seemed to run but I suspect it has an issue as I got this message for about 61 of 93 media items plus I cant see any evidence of serving webp

    /sites/astrabb.mull.pro/files//wp-content/uploads/2020/09/dd5640d2-a126-310d-9cf5-33587b301a42.png” converted to WebP is larger than original and has been deleted.

    the debug log is here
    https://www.dropbox.com/s/714rzd2vogcpklm/debug.log?dl=0

    Nothing sensitive in there as its a test system but I will remove the file after you say you have seen it.

    I can look at this more carefully in a day or two if you want.

    • This reply was modified 4 years, 6 months ago by keniry.
    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    @keniry I have one big request for you – please read the full description of the plugin once. There you will find answers to your questions.

    I checked that the following image was converted to WebP:

    And yet the original is loaded. Check it out here. This means that your Nginx configuration was wrong and the plugin will not work properly. The plugin intentionally displays some errors to inform the user about it.

    Everything is described in the FAQ.

    Thread Starter keniry

    (@keniry)

    @mateuszgbiorczyk

    There you will find answers to your questions.

    I do not have any questions, the plugin does not work with my config, I spent many hours and supplied and did what you asked and you just keep referring me back to non specific sections of the Description and FAQ like I am a naughty student who didn’t my the homework. Did I miss something ? probably – am I willing to look or help anymore. No. Good luck with your plugin it’s a nice idea …I imagine.

    I also got the same error and couldn’t fix it, if I add the code to the function then it works.

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    @keniry Please forgive me, but I am not able to help everyone with server configuration. By providing you with the plugin, I inform you what is not working by displaying the error.

    In the FAQ plugin is a sample configuration for Nginx, he personally tested. If your server is specific and requires a different configuration, you must take care of it on your own. The number of possible server configurations is huge. Only the administrator of a given server knows it fully. I gave an example for a basic Nginx setup that works. Adjust it to your needs.

    I am not able to spend many hours configuring the server for each person separately. That’s why I created a FAQ that answers most questions. If there was a problem in the plug, many people would report problems, looking at the number of active installations, and it is less than a percentage of all users.

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘server configuration error’ is closed to new replies.