• Resolved biiissen

    (@biiissen)


    Hi there,

    I’m using the W3TC pro version on an nginx server (no proxy) with Plesk management.
    The install instructions state that one should add this:

    include /var/www/vhosts/yoursite.com/nginx.conf;

    I did so (off course with the right path) in my Plesk Admin Panel at “Hosting & DNS > Apache / nginx > Additional nginx directives”. Is this OK? Because after setting everything up and checking my site with Google Pagespeed, it gives me all the suggestions to allow gzip, use next gen image formats etc. And the score is lower than it was before.

    So it really looks as if nothing is working at the moment. Is there a way to check if this nginx.conf has been loaded properly? What is the best way to troubleshoot?

    Thanks in advance for your help.

    Kind regards,
    Laurent

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @biiissen

    Thank you for reaching out and I am happy to help!
    Just to confirm, you are on nginx+apache setup?

    Can you please share the website URL and also, let me know if the nginx is serving static elements and if the nginx is bypassed by apache on your server.

    Thanks!

    Thread Starter biiissen

    (@biiissen)

    Hi @vmarko,

    thank you for your quick reply. No it’s a nginx only setup “Proxy mode” is turned off in the Plesk Admin Settings for this domain.

    Yes nginx is serving everything. And php is on a dedicated FPM application served by nginx also, if that makes a difference.

    URL would be: https://de.aqua-nobilis.com/

    Thanks in advance for your help!

    Regards,
    Laurent

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @biiissen

    I’ve checked your website and the caching works!
    Now, can you please share if you have an nginx.conf in the root of your website folder and also share the content of that file?

    I am not seeing any gizp suggestion, and as I can see you are using Brotli compression.

    Thanks!

    Thread Starter biiissen

    (@biiissen)

    Hi @vmarko,

    thank you for your quick response.

    You’re right the page loading works and the cached pages are delivered quite fast. However, please see this screenshot from Pagespeed Insights. That doesn’t look too promising, does it?

    Yes, the nginx.conf has been created and can even be accessed via the web server (is that normal and OK?): https://de.aqua-nobilis.com/nginx.conf

    Oh and nginx is giving me these errors when preloading pages:

    All in all there must be an error somewhere, or what am I getting wrong?

    Thanks for your help!

    Kind regards,
    Laurent

    • This reply was modified 11 months, 2 weeks ago by biiissen.
    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @biiissen

    I am getting different results and as I can see the biggest issue is related to the images and the image optimization.
    Google suggests that you should Serve images that are appropriately sized to save cellular data and improve load time.
    W3 Total Cache can lazyload images and convert them to webp, however, you also need to resize them for optimal performance on mobile pages.

    Reducing unused resources is also one of the recommendations, however, if you see the details, you can see that the resources are coming from third-party (external) servers

    Google CDN Cdn
    
    401.9 KiB
    
    208.0 KiB
    
    …cwQvQhsy4…/recaptcha__en.js
    
    (www.gstatic.com)
    
    200.9 KiB
    
    107.5 KiB
    
    …cwQvQhsy4…/recaptcha__en.js
    
    (www.gstatic.com)
    
    200.9 KiB
    
    100.5 KiB
    
    Google Tag Manager Tag-Manager
    
    369.9 KiB
    
    151.3 KiB
    
    /gtag/js?id=G-154PNXWQS6&l=dataLayer&cx=c
    
    (www.googletagmanager.com)
    
    88.2 KiB
    
    33.7 KiB
    
    /gtm.js?id=GTM-5Z59784
    
    (www.googletagmanager.com)
    
    60.6 KiB
    
    30.3 KiB
    
    /gtag/js?id=UA-101…-3
    
    (www.googletagmanager.com)
    
    67.9 KiB
    
    30.2 KiB
    
    /gtag/js?id=G-2Z2DB2ENWN&l=dataLayer&cx=c
    
    (www.googletagmanager.com)
    
    79.9 KiB
    
    29.0 KiB
    
    /gtag/js?id=AW-825…&l=dataLayer&cx=c
    
    (www.googletagmanager.com)
    
    73.4 KiB
    
    28.1 KiB
    
    Trusted Shops Utility
    
    64.2 KiB
    
    21.6 KiB
    
    /assets/trustbadge.js
    
    (widgets.trustedshops.com)

    To eliminate render-blocking resources, you should minify the files and use deffer embed for JS and also use the “Eliminate render-blocking css by moving it to HTTP body” option”

    Alternatively you can use Preload Requests option and add the files there to remove them as render blocking.

    Thanks!

    Thread Starter biiissen

    (@biiissen)

    Dear @vmarko,

    thanks again for your quick response!

    OK let’s take a look at another page: https://de.aqua-nobilis.com/shop/wasserhaehne/1-wege/wasserhahn-aqua-nobilis-enya-edelstahl/ for example:

    I set Javascript to “defer” (above </head>) and “async” (after body) “combine & minify” is active. “Eliminate render-blocking css by moving it to HTTP body” is active too. So this isn’t shown anymore and seems to work. Although I preloaded this page, so it was cached, Pagespeed Insights gives it a disastrous score. If I remember well the score was better without W3TC, so there must be a configuration problem? Can you think of one?

    What you also can see it asks for next-gen images. The webp extension is on and all the files have been converted. I checked it the .webp version of these images are available under the same name + .webp ending. Shouldn’t there be a rewrite rule that checks if a .webp is available and delivers this version then? If not it falls back to .jpg/.png… Or do I have to change all the files from all the products manually to the .webp versions?

    What about the error I got in the nginx log in my last post? The path to the file is missing “wp-content/cache/page_enhanced/de.aqua-nobilis.com/” (for German, for English and French it would course be “en” and “fr” respectively). Does this point to the nginx.conf not being loaded or do I have to set this somewhere by hand? How do I account for the different languages then?

    Thanks again for your valuable input!

    Kind regards,
    Laurent

    Thread Starter biiissen

    (@biiissen)

    Hi again,

    there must be a problem with the nginx.conf not being properly loaded. For testing, I manually copy-pasted the content of the nginx.conf to the “Plesk Admin > Additional nginx directives” and it reloads nginx without errors, however the rewriting of the .webp files for example isn’t done. Although I have this (and more) in the “Additional nginx directives”:

    location ~* ^(?<path>.+)\.(jpe?g|png|gif)$ {
      if ( $http_accept !~* "webp|\*/\*" ) {
        break;
      }
    
      expires 31536000s;
      etag on;
      if_modified_since exact;
      add_header Pragma "public";
      add_header Cache-Control "public";
      add_header X-Powered-By "W3 Total Cache/2.6.1";
      add_header Referrer-Policy "no-referrer-when-downgrade";
      add_header Vary Accept;
      try_files ${path}.webp $uri /index.php?$args;
    }

    Is there anybody else out there using nginx with Plesk and having a solution to this? I hope so…

    Kind regards,
    Laurent

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @biiissen

    As I can see, you have disabled the W3 Total Cache? and based on my testing the results are not as good as they were with the W3TC

    SO how the W3 Total Cache works: By default, when installed it detects if it’s apache or nginx server. Based on that and the settings, the W3 Total Cache adds the rewrite rules to the nginx.conf or .htaccess which should be in the website folder.
    Please note that any rules that are in the upper lever of the folder structure overwrite the rules set by the W3TC, like in this case the rules for the Browser Caching are not applied.

    You can check this with your hosting provider and see which rules may conflict, and how to apply the W3 Total Cache rewire rules correctly in your server setup.

    Thanks!

    Thread Starter biiissen

    (@biiissen)

    Dear @vmarko,

    thanks for clarifying!

    Yes, I got a bunch of 502: Bad Gateway messages plus my WP backend slowed down to about 8 secs loading time this morning, so I decided to see how all this turns out with WP Rocket (and no DB or object caching).

    You’re right the results for the pagespeed are about as bad… ??
    But my backend came back down to 3 secs loading time with WP Rocket. I’ve had this issue with Redis Object Cache plugin too, so that might have been linked to the object caching on redis that the W3TC does. Still I down get why caching makes my site slower, except conflicts and bad configuration.

    OK, perfect! Thanks for the hint with the priority linked to the folder level, I wasn’t aware of that. I’ll get rid of contradicting rules from the higher level and this issue should be resolved.

    I think we leave this topic right here and mark it as resolved.
    However I had one final question: What is included in the installation service you offer in your plugin? Are you configuring the server too, or only setting the right plugin variables?

    Kind regards and merry Christmas,
    Laurent

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @biiissen

    Please ask away any questions regarding any paid service directly via the plugin in Performance>Support, as this is against the wp.org guidelines.

    Thanks!

    Thread Starter biiissen

    (@biiissen)

    Hi @vmarko,

    thanks for your reply. Sorry, I wasn’t aware of that. OK, I’ll ask directly if needed.

    Kind regards,
    Laurent

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Setup W3TC on Nginx (no proxy) & Plesk’ is closed to new replies.