AWS CloudFront (AWS CDN) setup and usage tutorial; speed up WordPress

AWS CloudFront (AWS CDN) setup and usage tutorial; speed up WordPress

Due to my limited knowledge of the Internet, if there are any mistakes or omissions, please feel free to point them out.

1. A brief introduction to AWS CloudFront

Amazon CloudFront, also known as AWS CDN, has nodes distributed around the world, including in Asia, Japan, Hong Kong, Singapore, etc. Except for domestic nodes, no other nodes require filing.
The first year is free, and 50GB of data is provided every month. Only outgoing traffic is calculated, and incoming traffic is not counted.

AWS CloudFront official website: https://aws.amazon.com/cn/cloudfront/

2. AWS CloudFront Registration

AWS CloudFront has a Chinese page, and registration requires mobile phone and credit card verification.

3. Application and setup of AWS CloudFront

Take tg.tn as an example (at the host, bind tg.tn and www.tg.tn at the same time, and access the main domain name as tg.tn )

Enter the AWS CloudFront backend and click Create Distribution

Select WEB Acceleration

Origin Domain Name: can only be a domain name, www.tg.tn
Origin Protocol Policy: If security is important, use https
Query String Forwarding and Caching: Select All Caches
Compress Objects Automatically: Select YES


Apply for/import a domain name SSL certificate: https://console.aws.amazon.com/acm/home?region=us-east-1#/
AWS SSL certificate application and installation instructions are step by step and very simple.
When importing a certificate, choose the Apache format.

This is what is created. Select ID to enter CDN management and select EDIT

Alternate Domain Names(CNAMEs): Fill in the domain name to be accelerated
SSL Certificate: You can use AWS (free) or your own SSL certificate (free)

3. DNS resolution settings

Set it up at your own domain name resolution (domestic DNSPOD, DNS.COM, Huawei Cloud DNS, etc. are recommended)

www.tg.tn The A record of the whole network resolution is your host IP (resolution source)

tg.tn domestic resolution cname is xxx.cloudfront.net (the acceleration domain name given by cloudfront)
www.tg.tn The domestic resolution cname is xxx.cloudfront.net (the acceleration domain name given by cloudfront)


4. Setting up AWS CloudFront (AWS CDN) to accelerate WordPress

WordPress, because it requires login, comments, etc., other parts need to be set up. Programs like those that require logging in and commenting all need to be set up.

Go to your AWS CloudFront settings page, click Behaviors, and edit the default rules

Viewer Protocol Policy: HTTPS only is recommended, and Redirect HTTP to HTTPS is also available
Allowed HTTP Methods: Select GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE
Cached HTTP Methods: Select OPTIONS
Cache Based on Selected Request Headers: Select Whitelist
Whitelist Headers: Pull down and add Host and Origin

Then create new Behaviors

Path Pattern: /wp-login.php
Forward Cookies: Select Whitelist
Whitelist Cookies: Add as follows
comment_author_*
comment_author_email_*
comment_author_url_*
wordpress_*
wordpress_logged_in_*
wordpress_sec_*
wordpress_test_cookie
wp-settings-*


Continue creating new Behaviors
Path Pattern: /wp-admin/*


Continue creating new Behaviors
Path Pattern: /wp-json/*


Reference: https://jeffreyeverhart.com/2018/12/07/setup-aws-cloudfront-for-wordpress-scaling-this-blog/, and get enthusiastic guidance from the owner of SaltyFishTech.

<<:  Pyclouds: 352 yuan/month/1GB memory/20GB space/unlimited traffic/300Mbps-1Gbps port/independent IP/KVM/Hangzhou Mobile

>>:  Liuliu Cloud: 28/month/1GB memory/20GB SSD space/unlimited traffic/5Mbps-15Mbps port/KVM/Hong Kong CN2 GIA/Los Angeles CN2 GIA

Recommend

Alibaba Cloud International 1GB RAM SSD Hard Drive Hong Kong CN2 KVM VPS Review

Details : Alibaba Cloud International: $4.5/month...

Eleven2 – 40% discount coupon for the old American host

Eleven2 is a very old American hosting company th...

HostMonster-US Hosting Provider Introduction and Review

In 2006, HostMonster was jointly selected as the ...

AlphaRacks: $15/year/1GB memory/20GB space/1.5TB traffic/KVM/Los Angeles

AlphaRacks, which has been introduced many times,...

adman: $34/year/2GB RAM/20GB SSD space/unlimited traffic/100Mbps/KVM/Novosibirsk

adman.ru, a long-established Russian hosting prov...

Hostodo: $12.99/year/3GB memory/50GB space/2TB traffic/OpenVZ/Los Angeles

Hostodo, which has been introduced many times, no...

ZNetLive: .com domain name 1.34 USD

Znetlive was established in 2001 and provides com...

TNAHosting: $5/month/2GB RAM/100GB storage/1TB bandwidth/KVM/Chicago

TNAHosting is an American hosting provider with a...