Hướng dẫn cdn amazon canhme

Amazon Cloudfront là mạng CDN phân phối nội dung tĩnh và streaming toàn cầu của Amazon. Khi bạn sử dụng CDN sẽ giúp cho khách truy cập nhanh vào dữ liệu máy chủ web gần họ nhất thay vì phải truy cập vào trung tâm dữ liệu của nhà cung cấp hosting bạn đang dùng.

Hiện tại Amazon Cloudfront đang có các POP ở US, EU, Hong Kong, Philippines, S. Korea, Singapore & Taiwan, Japan, South America, Australia, India nên khi sử dụng chắc chắn tốc độ website của bạn sẽ được tăng lên một cách đáng kể từ VN.

Cách thức hoạt động của Amazon Cloudfront được mô tả như hình dưới:

Chi phí sử dụng Cloudfront rất rẻ, bạn chỉ phải trả phí cho những gì sử dụng mà thôi, xem chi tiết ở link này. Lưu ý Cloudfront sử dụng Amazon S3 để lưu trữ dữ liệu nên trong hóa đơn hàng tháng bạn sẽ thấy xuất hiện thêm khoản này nữa.

Cách tạo Amazon Cloudfront

1. Truy cập vào CloudFront Management Console và nhấn vào Create Distribution.

2. Tiếp theo giữ nguyên lựa chọn Web, nhấn Continue.

3. Trong phần Origin Settings, bạn hãy điền vào domain của bạn trong ô Origin Domain Name và Origin ID, những phần khác để mặc định.

Trong Distribution Settings, hãy lựa chọn server location mà bạn muốn sử dụng, mình khuyên nên chọn US, EU và Asia.

Alternate Domain Names hãy điền subdomain bạn muốn sử dụng cho CDN. Những ô khác để mặc định rồi nhấn tiếp Create Distribution.

4. Nếu không có lỗi gì bạn sẽ quay trở lại màn hình CloudFront Management Console và sẽ thấy CDN của mình đang được tạo [mất khoảng 15ph]. Khi nào cột Status báo Deployed thì CDN đã sẵn sàng hoạt động rồi đó.

Cài đặt CNAME

Vẫn ở trong màn hình AWS Management Console, bạn hãy copy CloudFront domain name và tạo mới một bản ghi CNAME và trỏ đến domain này.

Đợi domain nhận CNAME và Distribution được tạo xong thì CDN sẵn sàng hoạt động rồi đó.

Tiếp theo bạn hãy cài đặt CDN cho blog với WP Super Cache.

WP Super Cache là plugin cache mình đang sử dụng trên Chia Sẻ Coupon, việc cài đặt plugin này mình sẽ không đề cập đến trong bài này mà sẽ chỉ hướng dẫn mọi người cách sử dụng CDN với WP Super Cache mà thôi.

[alert-note]Trước khi tiến hành cài đặt, bạn cần chắc chắn CDN đã hoạt động rồi bằng cách truy cập thử vào link 1 file image bất kỳ và thay sub-domain CDN vào, ví dụ: //cdn.canhme.com/image.jpg[/alert-note]

Cài đặt WP Super Cache sử dụng CDN

1. Bạn hãy vào WP Super Cache Settings, chọn tab CDN

2. Nhấn Enable CDN Support và nhập domain CDN của bạn trong ô Off-site URL.

3. Cuối cùng nhấn Save Changes và xóa tất cả cache hiện tại.

[alert-success]Có thể bạn chưa biết: Nếu kích hoạt Don’t cache pages for known users trong tab Advanced thì những ai đã từng comment trên site sẽ không được dùng cache -> tốt nhất hãy disable option này.[/alert-success]

Amazon CloudFront is a content delivery network [CDN] that accelerates delivery of static and dynamic web content to end users.

CloudFront delivers content through a worldwide network of data centers called edge locations. When an end user requests content that you’re serving with CloudFront, the request is routed to the edge location nearest to the end user with the lowest latency.

CloudFront delivers content by leveraging the AWS global network that connects AWS edge locations to AWS regions. Moving the network traffic along the AWS network reduces latency and improves your application's security posture. Increase the reliability and availability of your web applications by having copies of your files cached at multiple edge locations across the globe.

Introduction to Amazon CloudFront

Log in to AWS to setup CloudFront

AWS Free Tier includes 1 TB data transfer out. 10,000,000 HTTP and HTTPS requests plus 2,000,000 CloudFront Function invocations each month.

Create a distribution

Create a CloudFront distribution to tell CloudFront where you want content to be delivered from, and how to track and manage content delivery.

Start delivering content faster

Tutorials

Amazon CloudFront

Deliver content faster

Deliver content and decrease end-user latency using Amazon CloudFront

Amazon CloudFront

Amazon S3 distribution

Set up an Amazon CloudFront distribution for Amazon S3 to make your website load faster

Amazon CloudFront

Write Function Code

Write lightweight functions in JavaScript for high-scale, latency-sensitive CDN customizations

AWS Training: Amazon CloudFront free online courses

AWS offers free online courses to help you learn how to architect solutions using Amazon CloudFront.

Learn more by browsing the training options below and visit here for all AWS CloudFront courses.

AWS Networking

AWS Networking Basics

An overview of available network services and common use cases using these services

Amazon MediaLive, MediaStore, CloudFront

Build a Live Video Channel

Create a live streaming video workflow using AWS Elemental MediaLive, AWS Elemental MediaStore, and Amazon CloudFront

Videos

Deploying a JAMSTACK application using S3, CF, Lambda@edge [45:59]

Delivering amazing video experience with CloudFront [57:23]

How to setup CloudFront for EC2 origin [9:07]

A short demo of Amazon CloudFront [2:05]

Setting up CloudFront with a WordPress Site [19:01]

Introduction to Amazon CloudFront and Lambda@Edge [53:24]

Delivering the Amazing Video Experience [57:23]

Layered Perimeter Protection for Apps Running on AWS [53:56]

Four Ways to Leverage CloudFront in Faster DevOps Workflows [50:57]

Taking Serverless to the Edge - AWS Online Tech Talk - May 2018 [24:27]

Additional resources

Documentation & downloads

AWS support for Internet Explorer ends on 07/31/2022. Supported browsers are Chrome, Firefox, Edge, and Safari. Learn more »

Chủ Đề