1. Chào mừng Khách tham gia cộng đồng Android Việt Nam

topbigslide

Speed up your site with a CDN - Cài đặt tăng tốc xenforo với CDN

Speed up your site with a CDN - Cài đặt tăng tốc xenforo với CDN

  1. King
    Bạn đã từng nghe tới từ “CDN” hay “Content delivery network” bao giờ chưa? Vậy CDN là gì? Chúng ta cùng tìm hiểu về CDN và CDN đem lại lợi ích gì cho ta.

    Rất nhiều website bạn vào hàng ngày sử dụng CDN nhưng bạn lại không để ý và không biết nó có tác dụng gì. Lí do nữa là chưa có một website Việt Nam nào đi sâu về CDN nên thông tin về CDN bằng tiếng Việt rất ít. Bài viết này, chúng ta cũng đi tìm hiểu về CDN và tác dụng của nó và cách áp dụng vào xenforo.


    What is a CDN?

    A content delivery network or content distribution network (CDN) is a large distributed system of servers deployed in multiple data centers across the Internet. The goal of a CDN is to serve content to end-users with high availability and high performance. CDNs serve a large fraction of the Internet content today, including web objects (text, graphics and scripts), downloadable objects (media files, software, documents), applications (e-commerce, portals), live streaming media, on-demand streaming media, and social networks.

    Content providers (eg. XenForo sites) pay CDN operators to deliver their content to their audience of end-users. Besides better performance and availability, CDNs also offload the traffic served directly from your own site, resulting in possible cost savings and load reduction on your server.

    [​IMG]

    KeyCDN is a powerful and easy to use Content Delivery Network (CDN).
    I have used several (MaxCDN, CDN77, Cloudfront), and found it to be the best and cheapest. It's Pay As You Go, so you only pay for what your site uses. They support SSL and SPDY, as well as your own site being HTTPS (not all CDN's do!). And best of all, it's only $0.04 per GB (for the first 10 TB) of CDN data used.
    As an example, an average XF site with around 500k page view per month would use around 150GB CDN traffic costing you only approx. $6 per month.


    Why Use a CDN?
    The number one reason for using a CDN is to improve your user's experience in terms of speed, and as we know - speed matters! Ensuring a consistent experience for all your users is important.

    Your XenForo site may be hosted in a particular region (where its's cheaper!), but have the majority of its users coming from an entirely different region - for example, if your site is hosted in North America, but if a good chunk of your users come from Europe or Australasia - their speed will not be as fast as it could be.

    A global CDN would allow users from Europe or Australasia to download static content from a closer source. Instead of spanning the Atlantic ocean to retrieve data, they can connect to a server in say, London, Melbourne, to get the same data. This reduces latency and provides a faster loading of your XenForo community site.

    CDNs not only ensure a faster experience to your users, but they also help to prevent site crashes in the event of traffic surges - CDNs help to distribute bandwidth across multiple servers, instead of allowing one server to handle all traffic.

    [​IMG]


    Steps to setup a CDN for your XenForo site using KeyCDN

    Create your CDN account, and setup your site within it....
    1. Visit KeyCDN and click the 'Sign Up' button/link in the top right-hand corner, and create you 30 days free trial account.
    2. Activate your account, following the instructions emailed to you.
    3. One logged-in, on the left-hand side navigation menu, go to 'Zones'.
    4. Click '+New Zone'.
    5. Enter your Zone Name (eg. your XF Site Name), set your Zone Status to Active, and your Zone Type to Pull
    6. Enter your Origin URL being your XF site URL (eg. http://www.myXFsite.com)
    7. Click Save and return to the Zones page.
    Configure your XenForo site to use the CDN....
    1. Connect via SSH, SFTP, or FTP to your server
    2. Change to the 'library' folder of your site
    3. Edit file 'config.php' and add the below two lines at the bottom, replacing [ZoneURL] with your Zone URL displayed on the Zones page. (eg. http://<MyXFSiteName>-fcc.kxcdn.com)
    // CDN support
    $config['externalDataUrl'] = 'http://[ZoneURL]/data';
    $config['javaScriptUrl'] = 'http://[ZoneURL]/js';
    1. Save the above addition to your config.php
    2. Login to your XenForo sites admin area (eg. http://www.myXFsite.com/admin.php)
    3. Navigate to Appearance -> Style Properties -> General
    4. Within the 'Path to Images' field, add your Zone URL to the beginning. Eg. changing "styles/<yourstyle>" to "http://<MyXFSiteName>-fcc.kxcdn.com/styles/<yourstyle>"
    Done!

    Your site is now using your CDN to deliver static files (style images, attachments, javascript, etc.) from servers closest to your users. Visit your Real-time Logs or Real-time Stats pages to see your site traffic using your CDN. Other reporting, such as Analytics and Geo Stats tells you how much data and from which locations your users are consuming your CDN.

    Before your free trial (and $5 bonus credit!) expires, visit the Payment page to buy additional credits for your account, using PayPal or your credit card.


    Disclaimer: The links to KeyCDN are using an affiliate link that gives you $5 sign-up credit, and me a percentage of your first payment if you remain beyond the free trial period. Fair enough for writing this guide and steps eh?

Bạn đang xem Zing.vn Mobile trên màn hình máy tính hoặc thiết bị trình chiếu mà giao diện này không hỗ trợ.

Chuyển về giao diện đầy đủ