Learn about Centmin Mod LEMP Stack today
Become a Member

Wordpress varnish and wordpress

Discussion in 'Blogs & CMS usage' started by ahmed, Jun 1, 2020.

  1. ahmed

    ahmed Active Member

    312
    47
    28
    Feb 21, 2017
    Ratings:
    +58
    Local Time:
    7:07 PM
    Hi

    I modified this guide for worpdress and now I got this error



    Code:
    Starting nginx: nginx: [emerg] duplicate listen options for 0.0.0.0:443 in /usr/local/nginx/conf/conf.d/domain.ssl.conf
    

     
    Last edited: Jun 1, 2020
  2. ahmed

    ahmed Active Member

    312
    47
    28
    Feb 21, 2017
    Ratings:
    +58
    Local Time:
    7:07 PM
    changing the

    # listen 443 ssl http2 backlog=2048 reuseport;

    to

    listen 443 ssl http2;

    solved the issue

    am I doing something wrong?
     
    Last edited: Jun 1, 2020
  3. ahmed

    ahmed Active Member

    312
    47
    28
    Feb 21, 2017
    Ratings:
    +58
    Local Time:
    7:07 PM
    and now I got this from varnish

    Code:
    varnishd[1690]: Error: -T 127.0.0.1:80 could not be listened on.
    after enabling this

    Code:
    upstream proxy_backend {
       zone upstream_dynamic 512k;
       keepalive 256;
       #least_conn;
       # proxy to varnish cache backend
       server localhost:6081 weight=1;
       # proxy to nginx backend
       #server localhost:8686 weight=1;
    }
    
     
  4. ahmed

    ahmed Active Member

    312
    47
    28
    Feb 21, 2017
    Ratings:
    +58
    Local Time:
    7:07 PM
    my settings are:

    Code (Text):
    
    .vcl
    port = "8686"
    
    ssl.nginx
    
    server { listen 80; server_name domain www.domain; return 302 https://$server_name$request_uri; }
    
    listent to port 443 and 80
    
    not.ssl.nginx
    
    listen to port 8686
    
    
    
    upstream proxy_backend {
       zone upstream_dynamic 512k;
       keepalive 256;
       #least_conn;
       # proxy to varnish cache backend
       server localhost:6081 weight=1;
       # proxy to nginx backend
       #server localhost:8686 weight=1;
    }
    
    
    
     
  5. ahmed

    ahmed Active Member

    312
    47
    28
    Feb 21, 2017
    Ratings:
    +58
    Local Time:
    7:07 PM
    now when I changed the las step of varnish parmater to
    6081 I got nginx error and varnish error gone

    Code (Text):
    
    : nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)Jun 01 13:52:37 centos-7-1 nginx[5699]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)Jun 01 13:52:38 centos-7-1 nginx[5699]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)Jun 01 13:52:38 centos-7-1 nginx[5699]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)Jun 01 13:52:39 centos-7-1 nginx[5699]: nginx: [emerg] still could not bind()
    
    
     
  6. eva2000

    eva2000 Administrator Staff Member

    44,527
    10,170
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,742
    Local Time:
    3:07 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    Varnish vcl settings go in their own Varnish vcl config file not Nginx vhost. So read up on Varnish documentation.

    Centmin Mod is provide as is, so short of scripted related bugs or issues, any further optimisation to the web stack components - nginx, php-fpm, mariadb mysql, csf firewall etc or web app specific Varnish cache configurations are left to the Centmin Mod user to deal with. So I do not provide any free support for such.

    However, Centmin Mod users are free to help each other out and ask questions or give answers on this community forum. My hopes are that this community forum evolves so that more veteran long time Centmin Mod users help new Centmin Mod users out :)

    But Varnish cache isn't needed with Centmin Mod centmin.sh menu option 22 wordpress installs as default caching all are equivalent to Varnish cache for full guest HTML page caching as per Wordpress - Differences between Wordpress regular install vs centmin.sh menu option 22 install
    There is literally nothing else needed to be done for performance/caching when you install Wordpress site via centmin.sh menu option 22. You get the fastest performance for your Wordpress blog out of the box if you choose one of the 3 default pre-configured caching methods. The fastest and least problematic being KeyCDN Cache Enabler + Autoptimize + Autoptimize Gzip Companion plugin
     
  7. ahmed

    ahmed Active Member

    312
    47
    28
    Feb 21, 2017
    Ratings:
    +58
    Local Time:
    7:07 PM
  8. eva2000

    eva2000 Administrator Staff Member

    44,527
    10,170
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,742
    Local Time:
    3:07 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    In general Varnish cache if configured for specific web app can be faster in pure throughput as Varnish cache can be either memory mapped or file mapped cache versus Nginx having only file mapped cache. That guide is for Magento not Wordpress so different web app. But for Wordpress, centmin.sh menu option 22 and KeyCDN Cache Enabler + Autoptimize + Autoptimize Gzip Companion plugin are most optimal as it isn't just about through put but latency and page speed.

    As to benchmarks, Centmin Mod 123.09beta01 using centmin.sh menu option 22 wordpress install with KeyCDN Cache Enabler caching for full guest HTML page cache can push 5,000+ user concurrency for 300 million hits per day on just an optimally configured 2GB KVM VPS server in synthetic benchmarks for guest non-logged in traffic. Place that in front of optimally configured Cloudflare CDN caching and you can handle even more without any of the complicated additional configurations with Varnish Cache. If you know Varnish Cache very well for each web app you use (yes you need to configure Varnish for each specific web app it isn't set once and all web apps can use it), then you can use it. You need to understand each web app very well to do that. If you don't know Varnish Cache nor do you know the ins and outs of each web app very well, then do not use Varnish Cache as just installing Varnish and not configuring for each web app, will just result in either no caching or caching the wrong thing (private data exposed publicly) or both issues.
     
  9. buik

    buik “Winners never quit, and quitters never win.” Premium Member

    1,276
    343
    83
    Apr 29, 2016
    Ratings:
    +1,032
    Local Time:
    7:07 PM
    In addition to @eva2000 you don't want to use 2 webservers at the same time, unless there is really no other way.

    That means if something goes wrong, you will need to debug Varnish as extra beside Nginx and in combination with Nginx<>Varnish.
    And not to forget php-fpm, mariadb mysql, csf firewall etc.

    Looks like you're using magento2. All what you need is a stable project where the customer use your e-commerce services at any time. Speed is secondary. Unless you are Amazon or Aliexpress.

    If everything goes well on your e-commerce service you don't have time at all to debug :)
     
  10. eva2000

    eva2000 Administrator Staff Member

    44,527
    10,170
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,742
    Local Time:
    3:07 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    +1 As I said at varnish and wordpress, Centmin Mod centmin.sh menu option 22 default cache methods are fine as folks do not need Varnish Cache - which in the long run will cost you more each time you troubleshoot Varnish caching issues if you do not know how to use and configure Varnish Cache and have to hire someone to fix such issues. And well if you use Cloudflare in front, a properly configured Cloudflare CDN cache setup, would do just as well as Varnish cache and scale better considering Cloudflare has over 200+ datacenters and servers serving your site for cached hits.

    Centmin Mod 123.09beta01's centmin.sh menu option 22 with KeyCDN's Cache Enabler + Autoptimize + Autoptimize Gzip Companion plugin are most optimal and least problematic way to accelerate Wordpress performance and works very well with Cloudflare CDN caching. Example, my centmin.sh menu option 22 created Wordpress blog at https://servermanager.guide/ :)

    He is using Wordpress just trying to follow my 2yr old Magento 2 Varnish cache guide. Note in that guide I compared Magento native Redis full page HTML cache served via PHP-FPM versus Varnish+Nginx full page HTML cache offloading to Varnish cache. This isn't same as centmin.sh menu option 22's redis nginx level full page HTML cache nor is it same as KeyCDN's Cache Enabler full page HTML cache - where both of these serve the cache via Nginx bypassing PHP-FPM. Magento native Redis cache doesn't bypass PHP-FPM but depends on PHP-FPM for cache logic and thus has poor performance compared to Varnish Cache or compared to centmin.sh menu option 22's redis nginx level full page HTML cache or is KeyCDN's Cache Enabler full page HTML cache which do bypass PHP-FPM and offload caching to Nginx server itself.

    Note KeyCDN's Cache Enabler by default has simple mode which uses PHP for cache logic for full HTML page cache so doesn't bypass PHP. But KeyCDN Cache Enabler has an advanced cache mode via Nginx rules which Centmin Mod centmin.sh menu option 22 Wordpress installer will enable and configure so that full HTML page cache bypasses PHP-FPM and uses Nginx web server. So Centmin Mod's Cache Enabler caching will be faster than other non-centminmod setup Cache Enabler based Wordpress sites.
     
  11. ahmed

    ahmed Active Member

    312
    47
    28
    Feb 21, 2017
    Ratings:
    +58
    Local Time:
    7:07 PM
    I'm not an expert and I do trust your opinions, and probably I will follow your recommendations, the problem is that many reports online advise using varnish for woocomerce as this is the fastest option, but maybe these reports did not try your advanced customizations.
     
  12. eva2000

    eva2000 Administrator Staff Member

    44,527
    10,170
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,742
    Local Time:
    3:07 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    Well if you know how to install and configure Varnish Cache, you can probably use it. But if you don't then I wouldn't as Varnish Cache requires a very high level knowledge for Varnish Cache itself and VCL definitions/configuration and also high level knowledge of all the web apps you intend to use it for as each web app will need it's own specific Varnish Cache vcl custom settings for optimal operation. That knowledge includes understanding each web app's logged in versus logged out member operations and what cookies are set for them respectively by web app and which pages of the web app to exclude from caching etc i.e. shopping cart pages can't be cached so performance ultimately is how well your server's uncached performance is.
     
  13. ahmed

    ahmed Active Member

    312
    47
    28
    Feb 21, 2017
    Ratings:
    +58
    Local Time:
    7:07 PM
    I will test fasc-cgi too,
    while the 4th option for PHP-FPM fastcgi_cache based full page caching is currently available via a switch for private development and testing

    how can I get that switch?
     
    Last edited: Jun 3, 2020
  14. ahmed

    ahmed Active Member

    312
    47
    28
    Feb 21, 2017
    Ratings:
    +58
    Local Time:
    7:07 PM
    superfast https://servermanager.guide/

    Is there anything apart from KeyCDN's Cache Enabler + Autoptimize + Autoptimize Gzip Companion plugin
    in that site,

    that is the speed I'm talking about similar to varnish boost that I noticed when I used varnish (instant load of the pages)
     
  15. eva2000

    eva2000 Administrator Staff Member

    44,527
    10,170
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,742
    Local Time:
    3:07 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    PHP-FPM fastcgi_cache is like Varnish Cache requires understanding of web app and cookies to make work so more advanced and can be more work to troubleshoot. centmin.sh menu option 22 with KeyCDN's Cache Enabler + Autoptimize + Autoptimize Gzip Companion plugin is still the faster solution due to being able to pre-gzip compress your full HTML page cached requests.

    servermanager.guide was installed via install method outlined at https://servermanager.guide/122/how-to-install-wordpress-on-centmin-mod-lemp-stack-guide/ which has Autoptimize + Autoptimize Gzip Companion plugin + Cloudflare CDN cache in front.