Discover Centmin Mod today
Register Now

WP Rocket installation on Nginx

Discussion in 'Blogs & CMS usage' started by Mrbo, Feb 25, 2019.

  1. EckyBrazzz

    EckyBrazzz Active Member

    538
    112
    43
    Mar 28, 2018
    >>>>Click here<<<< i'm nearby......
    Ratings:
    +207
    Local Time:
    12:22 PM
    1.17.x
    10.3.x
    @fabianski and @eva2000 I took all steps, but I won't purse out WebP images.

    fabianski, thanks for sharing, noticed a little difference it the setup of the SatelliteWP/rocket-nginx setup as you have it on domain level and not on the nginx level. The rest is almost the same, final result is that my config is the same as yours.

    But still pulling out my gray hears, don't know what to do to get it working. I don't use the addon Nginx Serving WebP Images Conditionally Demo, but the plugin WebP Express because it does the same, only has the advantage that it converts on the fly when uploading a new image.

    With that plugin WebP Express and without wp-rockt all was fine.
     
  2. EckyBrazzz

    EckyBrazzz Active Member

    538
    112
    43
    Mar 28, 2018
    >>>>Click here<<<< i'm nearby......
    Ratings:
    +207
    Local Time:
    12:22 PM
    1.17.x
    10.3.x
  3. EckyBrazzz

    EckyBrazzz Active Member

    538
    112
    43
    Mar 28, 2018
    >>>>Click here<<<< i'm nearby......
    Ratings:
    +207
    Local Time:
    12:22 PM
    1.17.x
    10.3.x
    Getting a little confused, some work others don't. Project_CMM_7273.png
     
  4. fabianski

    fabianski Member

    99
    12
    8
    Feb 20, 2019
    Brazil
    Ratings:
    +31
    Local Time:
    12:22 PM
    I'm not seeing the rocket-nginx header on your site
     
  5. eva2000

    eva2000 Administrator Staff Member

    41,088
    9,194
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,104
    Local Time:
    1:22 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    for Centmin Mod Nginx, you'd want whatever site nginx rules in your domain level nginx vhost config file at domain.com.conf or domain.com.ssl.conf instead of at nginx.conf
     
  6. EckyBrazzz

    EckyBrazzz Active Member

    538
    112
    43
    Mar 28, 2018
    >>>>Click here<<<< i'm nearby......
    Ratings:
    +207
    Local Time:
    12:22 PM
    1.17.x
    10.3.x
    Hmmm, strange. I placed it in the same configuration as you did, but eva2000 tells to not to do that. What should I see when I do a curl -I ?
     
  7. EckyBrazzz

    EckyBrazzz Active Member

    538
    112
    43
    Mar 28, 2018
    >>>>Click here<<<< i'm nearby......
    Ratings:
    +207
    Local Time:
    12:22 PM
    1.17.x
    10.3.x
    @eva2000 If I use Alter HTML it seems to work a (bit) but get a big fat F at webpagetest.org. if I don't use Alter HTML it won't work
     
  8. EckyBrazzz

    EckyBrazzz Active Member

    538
    112
    43
    Mar 28, 2018
    >>>>Click here<<<< i'm nearby......
    Ratings:
    +207
    Local Time:
    12:22 PM
    1.17.x
    10.3.x
    Got the issue with WebP Working, placed this domain behind a Cloudflare PRO Plan + some extra paid services and it worked.
    I even got the headers of NGINX.....chache=YES (can't remember it exactly) and was happy with the result and made a backup and afterwards started the server again. After a while I did the check for the headers again, and, yep no more headers. Installed the SatelliteWP/rocket-nginx again on the domain but what I tried, the headers didn't show up anymore.

    After that I noticed that WebP worked I started to tune Cloudflare and the wp-rocket / autopimizer pluigins. Noticed that I still had troubles with the Lazy Load on the slider of the site, so I have to replace the original that comes with the theme with Slider 3 or something like that.

    Long story short
    Code (Text):
    #WP ROCKET
    
      include /usr/local/nginx/conf/wpincludes/mydomain.org/rocket-nginx/default.conf;
    
      include /usr/local/nginx/conf/wpincludes/mydomain.org/wpcacheenabler_mydomain.org.conf;
      #include /usr/local/nginx/conf/wpincludes/mydomain.org/wpsupercache_mydomain.org.conf;
      # https://community.centminmod.com/posts/18828/
      #include /usr/local/nginx/conf/wpincludes/mydomain.org/rediscache_mydomain.org.conf; 
    
      location / {
    
      include /usr/local/nginx/conf/503include-only.conf;
    
      # Enables directory listings when index file not found
      #autoindex  on;
    
      #wp rocket
      try_files $uri $uri/ /index.php?$args;
    
      # for wordpress super cache plugin
      #try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php?q=$uri&$args;
    
      # for wp cache enabler plugin
      #try_files $cache_enabler_uri $uri $uri/ $custom_subdir/index.php?$args; 
    
      # Wordpress Permalinks
      #try_files $uri $uri/ /index.php?q=$uri&$args;
    
      # Nginx level redis Wordpress
      # https://community.centminmod.com/posts/18828/
      #try_files $uri $uri/ /index.php?$args;
    
      }
    

    :muted:#@!$)$ (404 ERROR) and I did not go away on other pages, only the main page worked. It can be that it has to do with the fact that my theme is heavily modded to fit to my needs (translations of a new kind of page type etc), I already wasted a U$80 on a special domain extension that gave me 404 on everything except the main page after a modification. (It's for sale now, nicely priced, only $3500 first year afterwards $80 again:), domain extension did not fit to my needs anymore, but will keep it for 5-6 years, guess there will be a company / person that will buy it).

    Cloudflare, yes nice option but after testing found that here in Brazil traffic in Sâo Paulo instead of Miami and speed was ok, but could be better. In Australia loading times gone up(over 3 secs), so conclusion as I had before. Need more servers (MariaDB Enterprise galera cluster and some kind of rsync or Corosync and Pacemaker together with Cloudflare Load Balancing.) Think that it will become the first Centmin Cluster experiment:facepalm:.

    For now, I have ngx_pagespeed again because with the above I will save on expensive for extra servers and used the block below because Cloudflare and ngx_pagespeed don't like each other.
    Code (Text):
    # ngx_pagespeed & ngx_pagespeed handler
    #include /usr/local/nginx/conf/pagespeed.conf;
    pagespeed unplugged;
    #include /usr/local/nginx/conf/pagespeedhandler.conf;
    #include /usr/local/nginx/conf/pagespeedstatslog.conf;
    


    But still, for the great performance of wp-rocket I would like that it worked and still can't find what is wrong with the above.

    404 ERROR and the fact that the header of rocket-nginx was sky walking.

    So if anyone here on the forum has a clue or a tip to pinpoint me in a working situation, please post below!(y)
     
  9. fabianski

    fabianski Member

    99
    12
    8
    Feb 20, 2019
    Brazil
    Ratings:
    +31
    Local Time:
    12:22 PM
    You did this?

     
  10. EckyBrazzz

    EckyBrazzz Active Member

    538
    112
    43
    Mar 28, 2018
    >>>>Click here<<<< i'm nearby......
    Ratings:
    +207
    Local Time:
    12:22 PM
    1.17.x
    10.3.x
    @fabianski Well, I once did it but there is only one little difference in these files. Last time(s) I did not change it.

    Diff Checker
     
  11. fabianski

    fabianski Member

    99
    12
    8
    Feb 20, 2019
    Brazil
    Ratings:
    +31
    Local Time:
    12:22 PM
    Why are you modifying this file?

    You have to modify this in the file /usr/local/nginx/conf/conf.d/domain.com.ssl.conf

    like this: Diff Checker
     
  12. EckyBrazzz

    EckyBrazzz Active Member

    538
    112
    43
    Mar 28, 2018
    >>>>Click here<<<< i'm nearby......
    Ratings:
    +207
    Local Time:
    12:22 PM
    1.17.x
    10.3.x
    I only added GEOIP 2 to it, the only difference in these 2 files is that one gives the result of fastcgi_param SERVER_NAME $http_host; and the other fastcgi_param SERVER_NAME $server_name;
    The function is the same, output is a little different.

    I did change the /usr/local/nginx/conf/conf.d/domain.com.ssl.conf but I did not notice any difference with the result, so stopped changing it. Will give another try on my "lifetime free AWS amazon account". Great for testing. 744hr/m free usage.

    FYI, inside information released it to me. Made a call to Amazon Brazil, and they transfer my call to someone in Ecuador(first I thought, he's terrible with his Portuguese), he transferred me to an employ for support of AWS USA. Get a free Tier AWS account, and just a few days before the year expires, change the email address to [email protected] and get a new account on the same old that you had before. You get a new year with their free tier program on that email again:)
     
  13. EckyBrazzz

    EckyBrazzz Active Member

    538
    112
    43
    Mar 28, 2018
    >>>>Click here<<<< i'm nearby......
    Ratings:
    +207
    Local Time:
    12:22 PM
    1.17.x
    10.3.x
    @fabianski (expert in optimizing)
    @eva2000 (CF expert and CMM expert)

    Got a question and I think you both know the answer.

    curl -I https://domain.com it works
    Code (Text):
    curl -I https://domain.com
    HTTP/1.1 200 OK
    Date: Tue, 13 Aug 2019 16:55:01 GMT
    Content-Type: text/html; charset=utf-8
    Connection: keep-alive
    Set-Cookie: __cfduid=d7398024365d44ae00c4eea7a747303de1565715301; expires=Wed, 12-Aug-20 16:55:01 GMT; path=/; domain=domain.com; HttpOnly
    Last-Modified: Tue, 13 Aug 2019 13:03:02 GMT
    Vary: Accept-Encoding
    X-Powered-By: centminmod
    Vary: Accept-Encoding, Cookie
    Cache-Control: no-cache, no-store, must-revalidate
    X-Rocket-Nginx-Serving-Static: Yes
    Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
    X-Frame-Options: SAMEORIGIN
    X-XSS-Protection: 1; mode=block
    X-Content-Type-Options: nosniff
    Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
    Server: cloudflare
    CF-RAY: 505c36d989399c3f-AMS
    

    but here on a jpg, converterd to a WebP (with CF and the WebP Express plugin) it say's x-rocket-nginx-serving-static: No
    Code (Text):
    content-length: 8558
    cf-cache-status: HIT
    vary: Accept
    x-xss-protection: 1; mode=block
    x-content-type-options: nosniff
    cf-bgj: imgq:100
    etag: "5d158041-2400"
    cache-control: public, max-age=2678400
    x-rocket-nginx-serving-static: No
    status: 200
    content-disposition: inline; filename="80px-namecheap.webp"
    cf-polished: origFmt=jpeg, origSize=9216
    accept-ranges: bytes
    expires: Fri, 13 Sep 2019 16:31:40 GMT
    last-modified: Fri, 28 Jun 2019 02:49:37 GMT
    date: Tue, 13 Aug 2019 16:31:40 GMT
    cf-ray: 505c14a78b9e9d30-AMS
    expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
    x-powered-by: centminmod
    age: 537
    strict-transport-security: max-age=31536000; includeSubDomains; preload
    server: cloudflare
    content-type: image/webp
    :status: 200
    

    Is that normal, does it work as it should work?
     
  14. EckyBrazzz

    EckyBrazzz Active Member

    538
    112
    43
    Mar 28, 2018
    >>>>Click here<<<< i'm nearby......
    Ratings:
    +207
    Local Time:
    12:22 PM
    1.17.x
    10.3.x
    Guess it is resolved. Happy with the result:)

    Code (Text):
    curl -I https://domain.com
    HTTP/1.1 200 OK
    Date: Wed, 14 Aug 2019 06:25:34 GMT
    Content-Type: text/html; charset=utf-8
    Connection: keep-alive
    Set-Cookie: __cfduid=d433a64bd33f2ec4e498559f51e2cdaf01565763934; expires=Thu, 13-Aug-20 06:25:34 GMT; path=/; domain=.domain.com; HttpOnly
    Last-Modified: Wed, 14 Aug 2019 05:55:55 GMT
    Vary: Accept-Encoding
    X-Powered-By: centminmod
    Vary: Accept-Encoding, Cookie
    Cache-Control: no-cache, no-store, must-revalidate
    X-Rocket-Nginx-Serving-Static: Yes
    X-Rocket-Nginx-Reason: /wp-content/cache/wp-rocket/domain.com///index-https.html_gzip
    X-Rocket-Nginx-File: /home/nginx/domains/domain.com/public/wp-content/cache/wp-rocket/domain.com///index-https.html_gzip
    Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
    X-Frame-Options: SAMEORIGIN
    X-XSS-Protection: 1; mode=block
    X-Content-Type-Options: nosniff
    Is-Already-Gzipped: Yes
    Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
    Server: cloudflare
    

    Project_CMM_7288.png
     
    • Like Like x 1
  15. EckyBrazzz

    EckyBrazzz Active Member

    538
    112
    43
    Mar 28, 2018
    >>>>Click here<<<< i'm nearby......
    Ratings:
    +207
    Local Time:
    12:22 PM
    1.17.x
    10.3.x
    @fabianski I need a little help from you, probably you know it better as "inventor" of a working solution for CMM.

    I'm setting up a Multi WordPress with subdomains. All subdomains use the same domain.ssl.conf. That's one of the nice parts with WordPress Network when using it on multiple site configuration. You don't have to configure each domain. I placed the rocket-nginx from GitHub inside the ../wpincludes/domain.com/rocket-nginx

    Now I have a strange issue. On the Master domain it works, on the subdomains it does not work. They use and have the same settings.

    Code (Text):
    Last-Modified: Wed, 21 Aug 2019 17:47:33 GMT
    Vary: Accept-Encoding
    X-Powered-By: centminmod
    Vary: Accept-Encoding, Cookie
    Cache-Control: no-cache, no-store, must-revalidate
    X-Rocket-Nginx-Serving-Static: Yes
    Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
    X-Frame-Options: SAMEORIGIN
    X-XSS-Protection: 1; mode=block
    X-Content-Type-Options: nosniff
    Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
    Server: cloudflare
    

    And the subdomain that won't work
    Code (Text):
    Vary: Accept-Encoding
    Last-Modified: Wed, 21 Aug 2019 17:38:39 GMT
    X-Powered-By: centminmod
    X-Cache: MISS
    X-Cache-2: BYPASS
    X-Xss-Protection: 1; mode=block
    X-Content-Type-Options: nosniff
    X-Rocket-Nginx-Serving-Static: No
    Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
    Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
    Server: cloudflare
    


    As you can see, the headers of the first are oke, the second are wrong.

    Should I place the rocket-nginx on a other location??
     
  16. EckyBrazzz

    EckyBrazzz Active Member

    538
    112
    43
    Mar 28, 2018
    >>>>Click here<<<< i'm nearby......
    Ratings:
    +207
    Local Time:
    12:22 PM
    1.17.x
    10.3.x
    Hmm, thought let's put it into debug mode, now both give wrong headers :banghead: