• Resolved abc

    (@unrealpixel)


    Hi, I recently switched from Apache to a Nginx server. All went well bug my images are no longer webp because the plugin was run on Apache. When trying to reactive it, it said I needed to add code to my nginx.conf but I can’t add map directive there.

    This is the error:

    nginx: [emerg] "map" directive is not allowed here in /usr/local/directadmin/data/users/admin/nginx.conf:16
    nginx: configuration file /etc/nginx/nginx.conf test failed

    I’m using DirectAdmin to make the changes. I tried doing it through the Custom HTTPD Configurations in DA but this didn’t work. Even after trying to restart my server when adding it to the custom config.

    Hope you can help me, cheers.

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

Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Author kubiq

    (@kubiq)

    Hello,

    first of all, please update to version 1.8 – it solves some localhost and SSL issues.

    You need to configure your server properly to be able to load content from WEBP file even if the URL points to the JPG or PNG.

    This is just a demo code, that should help you, but feel free to change it and use whatever will work on your specific setup.

    In FAQ you can see what I use on every NGINX server and it works on different servers.
    https://wordpress.org/plugins/images-to-webp/#nginx%20config

    Maybe try to contact your hosting provider and ask him for help?

    Thread Starter abc

    (@unrealpixel)

    Hi, thanks for your quick response.

    Where do you add the code when using DirectAdmin? In the Custom HTTPD Configurations? If so, do you rebuild the ./build rewrite_confs?

    I updated to 1.8 but still couldn’t figure it out.
    Do you perhaps have a more direct way of contacting (Discord, Telegram?), that way I can send some images on how I add it.

    My hosting provider also said to add it throug the Custom HTTPD Configurations but like I said before that unfortunately didn’t work.

    Thanks for all your help already,
    Kind regards,
    Roel

    Plugin Author kubiq

    (@kubiq)

    Hi,

    unfortunately I have no experience with DirectAdmin – I’ve never worked with it – so I’m afraid I can not help you with this.

    Maybe you can ask your hosting provider to do it?
    Just send him these two code snippets and ask him to put it wherever it needs to be?

    Don’t forget to restart your nginx service then, otherwise it will not load new config.

    Thread Starter abc

    (@unrealpixel)

    Alright, I have tried adding it to the nginx.conf directly, but I still receive the same error even after restarting my server.

    Am I doing something wrong?

    Plugin Author kubiq

    (@kubiq)

    If you put it in correct place and you also restarted your server, then it should work.

    If not, then you really need to contact your hosting provider.

    Anyway… are you sure your server supports WebP?

    Thread Starter abc

    (@unrealpixel)

    Hi,
    I made a Hastebin with the nginx.conf
    https://hastebin.com/otivesafal.properties

    Please check it, I can’t seem to figure it out.
    I’m pretty sure my server supports Webp, I’ll ask my hosting provider.

    Thread Starter abc

    (@unrealpixel)

    Any update?

    Plugin Author kubiq

    (@kubiq)

    Sorry, but I’m not able just to read your 100 lines of nginx config and tell you where is the problem.
    I would need to test it and that’s not possible.
    If your hosting support is not able to help you, then probably no one can.

    Hey @unrealpixel I’ve been working with Nginx and those error are pretty common, just pay attention to the error messages/codes:

    nginx: [emerg] “map” directive is not allowed here in /usr/local/directadmin/data/users/admin/nginx.conf:16

    Have you checked that file on that line number?
    Also, check this and this, it may give you a lead to fix the issue.

    Quick Update: according to your file, you have a duplicated map directive in line:48 and line:78, remove one of them and try to restart Nginx service.

    Thread Starter abc

    (@unrealpixel)

    Still giving me the error.
    Is there any way to set an override?

    Thread Starter abc

    (@unrealpixel)

    Bump, nginx config is set 100% correctly.

    Thread Starter abc

    (@unrealpixel)

    Still not working.

    Plugin Author kubiq

    (@kubiq)

    That’s a pitty, because it works for me and hundreds of other users on Nginx…
    It’s simply some wrong configuration or something on your hosting or in WP…
    I would need to run few scripts and tests to solve it, but I can not ask you for access to your website and trying to navigate you somehow and instruct to do some test will took hours that I can not afford right now

    Better you do not redirect image file to webp files. That can make everything to be broken and unstable. And bad SEO.

    If you want to use webp then you should upload webp files to WordPress only.

    people caring too much about webp it is not very important.

    Plugin Author kubiq

    (@kubiq)

    I never saw any reference that is can have impact on SEO – give us some proof if you can

    And in next sentence your (again) wrong – you shouldn’t upload Webp to WP directly as it is still not fully supported in all browsers and just take a look on few analytics on some websites and you will see how many visitors have also old versions of browsers, so yes, in 2021 you still need fallback to PNG or JPG…

    There is also new better format called AVIF that has even better compression and I will create another plugin that will bring this for modern browsers soon

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Switched from Apache to Nginx’ is closed to new replies.