Currently Viewing Posts Tagged CDN

Small PHP 7.2 Compatibility Bug of W3 Total Cache

When I upgrade my php to php 7.2, I saw a lot of error log in the log file.

[error] 1502#1502: *625 FastCGI sent in stderr: “PHP message: PHP Warning: count(): Parameter must be an array or an object that implements Countable in /<purged>/wp-content/plugins/w3-total-cache/Cdn_Plugin.php on line 1203” while reading response header from upstream, client: 135.0.172.188, server: www.yinfor.com, request: “GET / HTTP/2.0”, upstream: “fastcgi://unix:/var/run/php/php7.2-fpm.sock:”, host: “www.yinfor.com”

 

It is a bug or error, or just a compatibility issue between php 7.2 and W3 Total Cache.

Based on the the dissus on the WP site, TeroSalminen has a workaround.

Replacing a line in “function get_replaced_urls()” seems to work:

Replace the line
if ( count( $this->_replaced_urls ) ) {
with
if ( $this->_replaced_urls && count($this->_replaced_urls) ) {
and test.

Amazon CloudFront adds Canadian edge servers

It is good to know that Amazon AWS service adds new edge locations in Montreal and Toronto for Cloudfront. I hope it will be soon to have a new edge in Canada West, such as Vancouver.

cf_toronto_2

Amazon CloudFront adds new edge locations in Montreal and Toronto, our first in Canada

We are pleased to announce the launch of our newest edge locations in Toronto and Montreal, our first edge locations in Canada. Adding locations in Canada has been frequently requested by our customers so we are excited to add these two locations to our global network. If you’re already using Amazon CloudFront, you don’t need to do anything to your applications as requests are automatically routed to these locations when appropriate.

These new edge locations help improve performance and availability to end users of your applications and support all Amazon CloudFront features at no additional cost. Pricing for the new edge locations in Canada is the same as that in the US.

We have also added a second edge location in Sao Paolo, Brazil, our third edge location in Brazil. With the addition of the new locations in Canada and the second edge location in Sao Paolo, Amazon CloudFront now has a total of 59 edge locations worldwide. To see a list of all Amazon CloudFront global edge locations, please see our edge location list. To learn more about the service, attend a monthly office hour session that includes Q&A with Amazon CloudFront Engineers and Product Managers. Visit Amazon CloudFront for more information and register for the next office hour.

Continue reading “Amazon CloudFront adds Canadian edge servers”

Dirty Hack: Add CDN support into phpBB 3.1.6

It works for phpBB 3.1.x, not just phpBB 3.1.6. For a national forum or global forum, it is a must to have a CDN support.

The way I used is not a formal extension or plugin. It is a hack, actually a dirty hack. If you have no experience for it, you can close this page now.

Now, let’s start.

  1. Backup everything of your phpBB, include files and database.\
  2. URL path example.
    Forum url is http://www.myforum.com/
    CDN url is http://myforum.kxcdn.com/
  3.  Open /includes/functions.php
    add following in line 5112

    // Add CDN path
    $cdn_cache = '//myforum.kxcdn.com/';

    Find following around Line 5216

    'T_ASSETS_PATH'         => "{$web_path}assets",
    'T_THEME_PATH'         => "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/theme',
    'T_TEMPLATE_PATH'      => "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/template',
          

    Replace by

    'T_ASSETS_PATH'         => $cdn_cache."assets",
    'T_THEME_PATH'         => $cdn_cache."styles/" . rawurlencode($user->style['style_path']) . '/theme',
    'T_TEMPLATE_PATH'      => $cdn_cache."styles/" . rawurlencode($user->style['style_path']) . '/template',

    Find following around Line 5230

    'T_STYLESHEET_LINK'      => "{$web_path}styles/" . rawurlencode($user->style['style_path']) . 'https://d22rw8pyewxbkl.cloudfront.net/theme/stylesheet.css' . $config['assets_version'],
    'T_STYLESHEET_LANG_LINK'    => "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/theme/' . $user->lang_name . 'https://d22rw8pyewxbkl.cloudfront.net/stylesheet.css' . $config['assets_version'],

    Replace by

    'T_STYLESHEET_LINK'      => $cdn_cache."styles/" . rawurlencode($user->style['style_path']) . 'https://d22rw8pyewxbkl.cloudfront.net/theme/stylesheet.css' . $config['assets_version'],
    'T_STYLESHEET_LANG_LINK'    => $cdn_cache."styles/" . rawurlencode($user->style['style_path']) . '/theme/' . $user->lang_name . 'https://d22rw8pyewxbkl.cloudfront.net/stylesheet.css' . $config['assets_version'],

    Save and overwrite the original file.

  4.   Open /includes/functions_content.php
    Find following around Line 902

    return preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/(.*?) \/><!\-\- s\1 \-\->#', '<img class="smilies" src="' . $root_path . $config['smilies_path'] . '/\2 />', $text);

    Replace by

    return preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/(.*?) \/><!\-\- s\1 \-\->#', '<img class="smilies" src="' .'//forum.kxcdn.com/forum/'.$root_path. $config['smilies_path'] . '/\2 />', $text);

    Save and overwrite the old file.

  5. Then purge cache in the ACP.

Look at the waterfall chat after this hack.

cdn-phpbb-hack

The CDN service provider is KEYCDN. You can apply through this link.

CDN77.com – API 2.0 Release!

Got email from CDN77. It announced that API 2.0 released.

Much more API features are now available. We worked hard so that we could give a positive answer to your most frequent questions:

“Can I create / edit / delete a CDN resource through API?”

YES! You can manage your CDN resources (incl. Live Streaming) easily with API.

“Can I integrate the reports to my internal tools using API?”

YES! All the data we provide you with in the Reports section + Logs are now reachable through API.

“Can I make changes to my account via API?”

YES! You can edit all the account details including the billing and invoicing section.

cdn77-api-2

More details of API 2.0, check the Documents.

CloudFront has Reports now

Amazon announced that CloudFront Usage Charts is available in Report and Analytics.

We are excited to let you know that you can now view your Amazon CloudFront usage with CloudFront Usage Charts, six new charts in the AWS Management Console. You can use the charts to track trends in data transfer and requests (both HTTP and HTTPS) for each of your active CloudFront Web distributions. The charts show your usage from each CloudFront region at daily or hourly granularity, going back up to 60 days, and they also include totals, average, and peak usage during the time interval selected.

Here are details on the six charts:

  • Number of HTTP Requests; Number of HTTPS Requests: These two charts (one for HTTP and one for HTTPS) show the number of HTTP or HTTPS requests served by edge locations in the selected region for the specified CloudFront distribution.
  • Data Transferred over HTTP; Data Transferred over HTTPS: These two charts (again, one each for HTTP and HTTPS) show the total amount of data transferred over HTTP or HTTPS from CloudFront.
  • Data Transferred from CloudFront Edge Locations to Your Users: This chart shows data transferred from CloudFront edge locations in the selected region to users, combining both HTTP and HTTPS usage.
  • Data Transferred from CloudFront to Your Origin: This chart shows data transferred from CloudFront edge locations in the selected region to your origin for POST, PUT PATCH, OPTIONS, and DELETE methods, again combining both HTTP and HTTPS.

 

cloudfront-report

Continue reading “CloudFront has Reports now”

Go back to Amazon AWS CloudFront

I start to use CDN from April 2010, with MaxCDN. Later, I moved to Amazon, FrontCloud in August, 2010.
For some reason, I move back to MaxCDN. I start to use MaxCDN again from June 2012. In April 2013, I started to use CDN77.
A few days ago, in March 2014, I go back to Amazon AWS CloudFront. It is a reliable CDN service provider. The price is pay as you go. Based on my network volume, I prefer this price structure.

I setup CloudFront with custom origin server. Add CNAME on it. One of the CDN rules is to use two CDN host name, not one, not three. Two is the perfect number and best performance.

I tested my new CloudFront CDN ping value through CA ping tool. There are over 30 monitoring stations worldwide. My testing result is:

  • AWS CloudFront CDN,

Average: 48.29
Median: 3.05

  • CDN77 CDN

Average: 51.69
Median: 20.15

It shows that CloudFront has better ping value.

The original testing data link.

Testing tool provided by CA Technologies. http://cloudmonitor.ca.com/en/ping.php

ca-ping-tool

Continue reading “Go back to Amazon AWS CloudFront”

Webfont doesn’t shown in Firefox 22

I have a site which is using web font in css. It looks good in Chrome, IE, etc., except Firefox. It just shew a square with the number, something like F052.

I did a lot of search and it took me about 4 hours, until now I got the solution.
It is only happened on cross domain resource.
It is only happened on Firefox.
It is only happened when using CDN.

When I use Firebug to look at the pipe, the woff web font file is aborted. The url is corrected.

Catalin Rosu gave the solution in this post.

Firefox doesn’t allow cross-domain fonts

Continue reading “Webfont doesn’t shown in Firefox 22”

Change CDN service provider to MaxCDN

I start to use CDN from April 2010, with MaxCDN. Here is the first post I mentioned it.
Later, I moved to Amazon, FrontCloud in August, 2010.
For some reason, I move back to MaxCDN. I start to use MaxCDN again from last week.
It is easy to implement MaxCDN.
The price is good, if you have a big volume or bandwidth requirement.
You can have One TB = 1000GB for $39.95.
And 30 day Money-Back Guarantee
No Monthly Fee

Continue reading “Change CDN service provider to MaxCDN”

Amazon extend Edge Locations in Paris

Got the newsletter from Amazon.

We’re excited to inform you about the addition of a new edge location in Paris, France to serve end users of Amazon CloudFront and Amazon Route 53. With this new location, CloudFront and Route 53 now have a total of 5 edge locations in Europe, and 18 total edge locations worldwide. Each new edge location helps lower latency and improves performance for your end users in that region. We plan to continue to add new edge locations worldwide throughout 2011.

It is a good news. I use Amazon CloudFront as a cache system, or CDN, on many sites. It always give a good performance from USA, Canada, etc. Now It has more and more edge locations around the world. So every one can get the content from the closer server.
Yes, this blog is also powered by Amazon FrontCloud.

Continue reading “Amazon extend Edge Locations in Paris”

MaxCDN has new Implementation Guides

Updated 2013.08.29 How to replaced by current ones.
When I start to use MaxCND, it has WordPress plugins only.
Now they added some new Implementation Guides to help their clients to use MaxCDN
Joomla Inegration Guide
It use ReReplacer Extension to implement MaxCDN on Joomla, one of the most popular Open CMS.

CloudFlare Integration Guide

This one tell you how to use CDN with CloudFlare.
It is good to provide more implementation guides to help CDN users to use MaxCDN services

  • Archives