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

$29/month/1G/160G space/4T traffic/5IP dedicated server——1paket.com

1paket.com is a German hosting company that has b...

GINERNET: €10/year/512MB RAM/5GB SSD space/100GB bandwidth/OpenVZ/Spain

GINERNET is a Spanish hosting provider with a dat...

HostingInside:$28/year/2 CPU/512MB/10GB SSD/500GB bandwidth/Xen

HostingInside is a Taiwanese hosting provider tha...

StartLogic US Hosting

Startlogic provides customers with strong support...

CloudCone: $40/year/512MB memory/100GB SSD space/2TB bandwidth/KVM/Los Angeles

CloudCone, a recently active hosting provider, pr...

Under Linux system, one-click network reinstallation system is Centos7

Originated from cxthhhhh.com. Only works with KVM...

90vm 1GB RAM Canada OVH KVM VPS Review

Details: 90vm: 24 yuan/month/512MB memory/10GB sp...

Large capacity VPS collection and recommendation

The collection and recommendation rules are: firs...