Question

what cdn should I use with serverpilot ? cloudflare or keycdn

I am a little bit confused about which CDN should choose? I will use $5 plan with severpilot. Since CloudFlare’s free plan does not give to use custom SSL that’s why I worried about.

which will best CDN provider in perspective of security and CDN service?

what is the drawback of keycdn ( if any)?

If I use any one of the above CDN still should I use the wp total cache?

Should I use varnish with serverpilot instead of any cache plugin?


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hello there,

and can We add the code line to config NGINX that Keycdn advise? Serverpilot say that we should not make changes in that file.

Any Idea please?

Thank you very much!

Step 3) Nginx Config#
In this step, we’re going to make some configuration adjustments to the Nginx config file. These rules define when to bypass the cache as well as define cache-control values.

server {
    server_name origin.example.com;
    listen 80;

    root /var/www/example;
    index index.php index.html index.htm;

    set $cache_path $request_uri;

    # bypass cache for POST requests
    if ( $request_method = POST ) {
        set $cache_path 'nocache';
    }

    # don't cache login/admin URLs
    if ($request_uri ~* "/(wp-login.php|wp-admin|login.php|backend|admin)"){
        set $cache_path 'nocache';
    }

    # don't cache if there is a cookie called PHPSESSID
    if ($http_cookie ~* "PHPSESSID"){
        set $cache_path 'nocache';
    }

    # bypass cache for logged in users
    if ( $http_cookie ~ (wp-postpass|wordpress_|comment_author)_ ) {
        set $cache_path 'nocache';
    }

    # bypass cache if query string not empty
    if ( $query_string ) {
        set $cache_path 'nocache';
    }

    location / {
        # this line is specific to Cache Enabler
        try_files /wp-content/cache/cache-enabler/${http_host}${cache_path}index.html $uri $uri/ /index.php?$args;

        if ($cache_path = 'nocache') {
            expires -1;
            add_header Cache-Control no-cache;
        }
    }

    # php7 fastcgi
    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        ...

        fastcgi_intercept_errors on;

        if ($cache_path = 'nocache') {
            expires -1;
            add_header Cache-Control no-cache;
        }
        if ($cache_path != 'nocache') {
            expires +1h;
        }
    }

    # static assets
    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
        log_not_found off;

        add_header Cache-Control "max-age=604800, stale-while-revalidate=86400, stale-if-error=604800";
    }
}

KeyCDN provides you with more flexibility compared to CloudFlare’s free plan. For instance, with KeyCDN you can use origin shield, push zones, free custom SSL, free Let’s Encrypt, real-time analytics and more. If you want to use some of these features with CloudFlare, you’ll need to upgrade your plan (as you already mentioned).

You should still be using a caching plugin on your Wordpress site to further accelerate the delivery of assets. With KeyCDN, you’ll need to integrate it directly within your Wordpress site, however this is pretty straightforward: https://www.keycdn.com/support/wordpress-cdn-integration-with-w3-total-cache/

If you want to learn more about the differences between KeyCDN and CloudFlare I’d recommend this comparison guide: https://woorkup.com/cloudflare-alternative/

Hey @sp234sp I work for section.io, and we allow you to do all that stuff! You may want to check us out.