The professional guide: How to set up an AIiExpress affiliate website in AWS
WordPress (EC2) + Amazon S3 + Cloudflare + WooCommerce + Admitad.
In this article, I will show you how-to step by step setup a WordPress site in Amazon EC2 with Cloudflare and Amazon S3 for your images. I will also show how to set up a backup for your WordPress site and finally, I will show how you set up WooCommerce with AliExpress products with Admitad links.
You need two things before we start. One domain name for your awesome website that will skyrocket you into the future and one domain name for your images. The reason you need two separate domain names is that you can’t do full(strict) — End-to-End HTTPS with Cloudflare and Amazon S3 and you want to use End-to-End HTTPS for your main site. More information about this at the end of this article. I recommend buying a domain from Namecheap.
For this tutorial, I have selected workhomeshop.com for my WordPress site and workhomeshop.site for images.
Let's grab a coffee and let us begin. ☕
Table of Contents
1 — Setup a Google account for your project
2 — Buy a domain name
3 — Sign up on Cloudlfare.com and set up the domain.
4 — Setup SMTP
5 — Setup WordPress site in AWS
6 — Install Cloudflare HTTPS for WordPress
7 — Login to WordPress WP-ADMIN (EC2 Bitnami)
8 — Install plugins WordPress
9 — Setup WP Mail SMTP with SendGrid
10 — Install WooCommerce
11 — Setup WP Fastest Cache with Cloudflare
12 — Setup Da Vinci 2.0 Woo
13 — Apply for AliExpress, setup Ali2Woo, and Import Products!
14 — Setup WordPress + Amazon s3 + Cloudflare
15 — Setup WordPress + Backup + Amazon S3
16 — Setup RankMath
17 — Enable Site Kit by Google
18— Add 2-factor authentication to WordPress
19 — Customize the look of the page, update texts..
20 — The Final settings in Cloudflare.
1 — Setup a Google account for your project
When I start a brand new website like this, I always start with creating a dedicated google account for the project. Because then I have all information in one place and if I decide to sell this project after a couple of years. I can easily transfer everything to the new owner.
The following three google services we will use
- Gmail
- Google Search Console
- Google Analytics
Google and Gmail setup
With only a few clicks you should be up and running with a new google account and Gmail. Start here and just follow these steps.
Done. Don’t forget to protect your account with 2-Step Verification
We continue to set up Google Analytics and the Google Search Console when everything is up and running.
2 — Buy a domain name
Either you own a domain that you can use for this project. Or you buy a new one. The choice is yours. I bought two new ones from namecheap.com for this project.
If you own a couple of domain names that are more than 6 months old, you can transfer them to Cloudflare.
3— Sign up on Cloudlfare.com and set up the domain.
Let's now start with Cloudflare. Because when we later launch our EC2 instance on Amazon. We do not want to expose the EC2 instance directly on the internet, we want to hide it behind Cloudflare CDN. Read more about why we don't want to expose EC2 IP in FAQ
Sign up on Cloudlare.com is very simple. Sign up here and follow the instructions.
- Sign-up with mail and password. Don’t forget to check your mail, you need to verify your email address.
2. Fill in your primary domain for your website.
example
3. Select a plan for your domain. Free, it's a good start :)
4. In the next step, you need to update your DNS name servers with Cloudflares DNS servers.
Sometimes, if you used your DNS before. You can see this, with your current addresses. Don’t do anything. Skip to next.
Copy and save Nameserver 1 & 2 address
If you use NameCheap, click on the DNS name, and use the dropdown list
Update the nameservers with your new Cloudflare address that you saved. The address ends with ns.cloudflare.com
Don’t use my nameservers in the image that I got from Cloudflare. Cloudflare generates random nameserver addresses.
Klick, next, and then on finish later, and you are now done with the first part.
Meanwhile, you can play with your kids or take a walk in the park. You will receive mail when DNS settings have changed. You can speed up the check by click on Re-check now.
It usually takes less than one hour for a nameserver update. You can do the same procedure (step 3) for your image domain while you wait for the primary domain to be active.
When you are done, activate 2-factor authentication on your Cloudflare account https://dash.cloudflare.com/profile/authentication. It's not a must, but a good recommendation.
4 — Setup SMTP
Before we continue with the setup in Amazon Web Services (AWS) we are going to do one small thing before we start. If you have a site you would be able to receive mail from hello@YourDomain.com. An easy and free solution for doing that is https://improvmx.com/. Sign-up with your domain + your Gmail address.
Create some alias, for example, hello@workhomeshop.com
Copy your MX info
Add MX and SPF records in the Cloudflare DNS portal.
5 — Setup WordPress site in AWS
If you don’t have an AWS account, you can sign-up for a free AWS trial account here. If you have an account, log in to the AWS Console.
Navigate to EC2 services (All Services -> Compute -> EC2)
Click launch new instance.
Search for WordPress, Click AWS Marketplace, and select “WordPress with NGINX and SSL Certified by Bitnami and Automatic”.
Some information about EC2 cost. If you worried about the cost, don’t be, AWS has great tools to monitor cost. But make sure you understand how AWS works and what generates cost here. A simple t3a.micro is about $6–$7 per month + cost for traffic, etc.
If you have a trial account select the T2.micro instance. Otherwise, I suggest t3.micro or t3a.mirco. My experience is that t3a.micro (AMD) has much better threading and doesn't get CPU steel so often. You can change this later — this is also the beauty with AWS. You can easily switch between instance types. Do you consider having more than 1000 products in WooCommerce, select small. By default, the instance has 10 GB of storage. For this setup, this will be good enough with 10 GB storage. Click Next: Configure Instance Details if you need more storage otherwise click Review and Launch.
In the next step, we approve the instance type. You can also see here your cost per hour.
You need a key pair to access your machine from the SSH client, PuTTY. You can either create a new one or choose an existing key pair. Then select launch instance!
More information on how you access the instance with key pair and SSH can be found in the FAQ at the end of this article.
Your new server instance is now starting, this takes less than a few seconds for AWS to do.
Click on the instance name.
Maybe not the most important step. Set a name on your new Instance.
Copy your Instance Public IPv4 address.
Go back to Cloudflare, click DNS. Create two new records.
A record for root with the AWS Instance IPv4 address.
A CNAME for www.yourdomain.com
Save. Next!
You are now done! You can now test your site with HTTP.
6 — Install Cloudflare HTTPS for WordPress
Before we continue with the setup of WordPress we will enable SSL for our site. And on top of that, we will make sure all connection is SSL encrypted, both between server-Cloudfront and Cloudfront-client.
Enable Full(strict) — Your site will stop working now. But don't panic, your site will be online again after you have done the following steps.
You should ssh to your instance. You will find information about how to ssh your site in AWS Console. Just click on your instance and then click connect.
More information about how you connect with PuTTy can be found in the FAQ.
Once you have loggedin to tour instance. You should now update wp-config.php
# Type
sudo nano apps/wordpress/htdocs/wp-config.php
# Scroll down and update WP_SITEURL and WP_HOME with HTTPS://.
# Save (Ctrl + X, Y)
In the next step, we are going to create SSL certs and the SSL key for your server.
Login to your Cloudflare account.
Click: SSL/TLS, Origin Server, Create Certifcate
You don't have to do anything here.
Klick Next
# Copy origin certificate (Ctrl + C)
# Login to your serversudo nano /etc/ssl/certs/cert.pem# Paste you certificate
# Save (Ctrl+X, S)# Copy Private Key (Ctrl + C)
# Login to your serversudo nano /etc/ssl/private/key.pem# Paste you certificate
# Save (Ctrl+X, S)# Click Ok in Cloudflare
Enable Authenticated Origin Pulls, click on help, and then on “Authenticated Origin Pulls” link. You will now be redirected to support page.
At bottom of the support page. You will find origin-pull-ca.pem. Right-click and copy the link.
Go back to your sever instance, login with SSH.
# Go to :
cd /etc/ssl/certs/# Download cert :
sudo wget https://support.cloudflare.com/hc/en-us/article_attachments/360044928032/origin-pull-ca.pem# Change name of the cert :
sudo mv origin-pull-ca.pem cloudflare.crt# Update your Nginx config with new SSL info
sudo nano /opt/bitnami/nginx/conf/bitnami/bitnami.confSave (Ctrl+X, S)
ssl_certificate /etc/ssl/certs/cert.pem;
ssl_certificate_key /etc/ssl/private/key.pem;
ssl_client_certificate /etc/ssl/certs/cloudflare.crt;
ssl_verify_client on;
# disable bitnami banner
sudo /opt/bitnami/apps/wordpress/bnconfig — disable_banner 1# restart services
sudo /opt/bitnami/ctlscript.sh restart
And now you are done!
7 — Login to WordPress WP-ADMIN (EC2 Bitnami)
Time to login to wp-admin and start working with the fun parts.
The address for WP-ADMIN is yourdomain.com/wp-admin
The password wp-admin can be found in the AWS Console
EC2 -> Instance -> yourinstance -> Action -> Monitor and troubleshoot -> Get system log
Scroll down and search for “Setting Bitnami application password..”
Once you have managed to log in to your WordPress. Then it’s time to start installing plugins, themes and make customizations.
8 — Install plugins WordPress
Installing a plugin in WordPress is very easy. Just click Plugins, Add New.
Search for a plugin, click install, activate.
“When logging in to WordPress from Bitnami for the first time. There are a number of pre-installed plugins. I recommend that you uninstall and remove them.”
9 — Setup WP Mail SMTP with SendGrid
Install WP Mail SMTP from plugins.
You can choose between several SMTP providers. For this setup I use SendGrid.
Create an account for SenGrid.
Klick settings -> API-keys
Click Create API Key in the right corner.
Set a name for your Key, select full access and
Click Create & View.
Copy your key, and save it. It will only be visible once.
Click Done!
Continue with the setup of WP Mail. Add your generated key.
Fill in the rest of the details and
Click “Save Continue”
Click Save Cont
If you like, share your mail with wpforms.
Click Save and Continue.
If you have a product key, otherwise click Skip this Step
Click Finish Setup
Update your default mail for WordPress.
Click Settings -> General Settings
10 — Install WooCommerce
This will be a very simple setup of WooCommerce. We don’t need to any advance here. The reason for this is that we are not going to set up a dropshipping store. We are only going to list products as affiliate products.
Go to plugins, add new, search for WooCommerce, Install and activate.
Go to WooCommerce -> Settings.
Update Country and Currency. Click Save Changes
You are now done with WooCommerce!
11 — Setup WP Fastest Cache with Cloudflare
Now it's time to speed up your website. A fast website is important and by default, WordPress is not so fast. Even if Bitnami has done some pre-optimizes you must also install the cache plugin. I prefer WP Fastest Cache for three reasons.
- Simple
- Fast
- Have a great integration with Cloudflare.
Go to WP Fastest Cache, CDM and click on “CDN by Cloudflare”
Go back to your Cloudflare account, and get Your API token.
View your Global API Key
Fill in your Cloudflare password and prove that you are human 😀
Copy and save your Cloudflare API key and go back to WordPress.
Now when you have your Cloudflare key, fill in your mail address for your Cloudflare account and add your APY key.
Click Next!
Click Next!
Click Next!
Click Next!
Click Finish!
Click Close!
You are now done with the Cloudflare integration.
Go to settings for WP Fastest Cache. Enable following
- Cache System
- Logged-in Users
- New Post (Clear All Cache)
Submit!
12 — Setup Da Vinci 2.0 Woo
We want a nice and responsive look on our website. One of the best and free Themes out there for WooCommerce webshop is the Da Vinci theme.
You can download the there form here.
https://alidropship.com/themes/da-vinci-2-0-for-woocommerce/
Go back to your WordPress site and add the new theme.
Apperance -> Add New
When the theme is uploaded to your site. You can now install it.
Click Install Now
Activate your theme!
Now is your theme active, lets start with the setup.
Click Davinci Woo -> General
Install these plugins.
- WooCommerce
- Classic Editor
- YITH WooCommerce Wishlist
- Contact Form 7
- AliDropship Woo Product Video
- Metric Converter
- Site Kit by Google
- GDPR Banner
- TinyMCE Advanced
Click Install Plugins
This is highly recommended, install Demo. When you install the demo you get a pre-fixed website that you can almost use directly. You can update the pre-settings later with your own logo, text, colors, etc.
Select all button and click Install Demo
You have now set up the Da Vinci 2.0 Woo theme and your site should look like this.
13 — Apply for AliExpress, setup Ali2Woo, and Import Products!
We come closer and closer to the finish line.
Soon you will have a 100% functional website with products you can promote and make some money.
In this step, we will set up the affiliate connection and start import products from AliExpress.
The first thing you need to do is sign-up for an Admitad account.
Some short information about Admitad;
“Admitad is a trusted, global affiliate network founded in Germany in 2009, headquarters in Russia, India, the Republic of Belarus, China, Ukraine, 300+ employees, over half a million publishers, and 1500 brands.”
Sign-up here to Admitad network
When you have sing-up to Admitad.
- Add your website as an Ad Space
- Search for AliExpress in ….. and Apply for AliExpress. Approval takes between 1–2 days.
- Copy your affiliate link for AliExpress
Now when we have an affiliate link for AliExpress. It's now time to setup a plugin we can use to import products to WooCommerce and apply our affiliate link.
IMPORTANT do not import products before you have received your affiliate link.
Click add plugin in your WordPress. Search for Ali2Woo. Click Install Now and then activate plugin.
Now when Ali2Woo is installed, we will change some default settings and apply the affiliate link we have received from Admitad.
Click Ali2Woo Lite -> Setting
Change Default Product type to External/Affiliate Products.
Save
- You can set this up as a Dropship. But if you have no experience of this, you should not do it. Better redirect customers directly to the AliExpress website.
Update account settings with your affiliate link.
Click Ali2Woo Lite -> Account Settings
Change Account type to Admitad account
Paste your affiliate link in the Cashback URL field.
Save settings
Now let’s start with import some products.
Click Ali2Woo -> Search Products.
Search for something, for example, “candles”
You can now either import a few products from the search result or you can “Add all to Import list”.
When you have import products to your Import list. You can now publish them to your store.
Click Ali2Woo Lite -> Import List
You can now either publish all products or a few products from your list.
If you want to Publish all products directly.
Click Select All Products, select in which category products should import too.
Click Push All Products to Shop
If you want to add a category to your site.
Click Products->Category
Add/Delete/Rename Categories
We recommend that you Now import 50–100 products in different categories. Ali2Woo Lite has a limit on publishing 100 products er day.
14 — Setup Wordpress + Amazon s3 + Cloudflare
In this step, we are going to setup Amazon S3 for our WordPress images, and we will use Cloudflare for distribution.
But, why do you want to use Amazon s3 for images?
If you have a big site with a lot of images. it will become expensive to store it in regular block storage. But the biggest win is the speed and availability of Amazon s3 as a backend for images. It’s a safe place to store your images for a low cost, no matter how big your image archive is or how successful you will become. Why do you think all big e-commerce sites using S3 for images?
What we need for this step.
- A domain name for your images
- S3 bucket
- Cloudflare account
- S3 plugin for WordPress
The domain name for your images.
If you haven't got a domain name for your images, go back to 2 — Buy a domain name
Setup of the domain name in Cloudflare.
You can repeat the steps (3 — Sign up on Cloudlfare.com and set up the domain.) for your image domain name.
When you have done the steps for your domain. Go to your image domain.
Go to SSL/TLS -> Overview and select Flexible
Create an S3 bucket for images
Login to your AWS-account and browse to the s3 section and create a new bucket.
Give your s3 bucket FQDN (Fully qualified domain name) name.
Example : content.myImageDomain.com
Choose the same AWS region as your EC2 instance.
Click Create bucket
Click Permissions and then Ediy Block public access(bucket settings)
Disable Block all public access and Save Changes
Confirm changes
After you have confirmed changes for Block public access it should look like this.
Now click on Edit Bucket policy.
Here in the bucket policy, we are going to restrict bucket access. We only want CloudFront should be able to access the bucket. You can copy-paste the code from here. Remember to change resource name to bucket FQDN.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AddPerm",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::content.workhomeshop.site/*",
"Condition": {
"IpAddress": {
"aws:SourceIp": [
"103.21.244.0/22",
"103.22.200.0/22",
"103.31.4.0/22",
"104.16.0.0/12",
"108.162.192.0/18",
"131.0.72.0/22",
"141.101.64.0/18",
"162.158.0.0/15",
"172.64.0.0/13",
"173.245.48.0/20",
"188.114.96.0/20",
"190.93.240.0/20",
"197.234.240.0/22",
"198.41.128.0/17",
"199.27.128.0/21"
]
}
}
}
]
}
After you have copy-paste the code.
Save Changes
Now go to Properties for your S3 bucket
Edit Static website hosting
Enable Static website hosting
Save changes
Copy-paste the URL for Static website hosting
Now when you have setup s3 bucket. Go back to DNS settings for your image domain in Cloudflare.
Add a new CNAME record (same FQDN as S3 bucket), set target to S3 static website hosting URL. Without HTTP and / at the end.
Save
You now are done with the first part. If you want you can try it and upload a file to your s3 bucket.
Create an access token for your s3 bucket
You have now created an s3 bucket for your images. Now you need to create credentials. So that you can upload and delete files in s3 from WordPress.
Log in to your AWS dashboard, in the top-left corner.
Click My Security Credentials.
The first thing we are going to create is a custom policy. We want to limit the user rights and access to a specific s3 bucket.
Click on Policies
Change the view from Visual editor to JSON
Click JSON and copy-paste the JSON code. Make sure you update Resource with your S3 FQDN.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:CreateBucket",
"s3:DeleteObject",
"s3:Put*",
"s3:Get*",
"s3:List*"
],
"Resource": [
"arn:aws:s3:::img.workhomeshop.site",
"arn:aws:s3:::img.workhomeshop.site/*"
]
}
]
}
In AWS you can create tags for almost everything. I will not go into more detail about how to use this in this tutorial. But it is a smart way to work with if you manage your AWS code from CLI. You can leave the field blank.
Click Next: Review
Set a name for your new policy and write some descriptions.
Click Create Policy
Now when you have created a policy. It's time to create a user.
Click Users
Set a name for your new user and select Access type: Programmatic access.
Click Next: Permissions.
We are now going to attach our policy to the users.
Click Attach existing policies directly
Search for your policy
Click Next: Tags
Again, if you think you will use tags in the future. Create a tag or leave it blank.
Click Next: Review
The final step, create your new user.
Click Create user
You have now created an S3 bucket user with a custom policy.
Save your Access Key ID and Secret access key. You need this for the next step.
Setup MEDIA CLOUD 4.2.x with Amazon S3
In this step, we are going to install a WordPress plugin for S3. When a file or Image is Uploaded to WordPress, the image should upload to S3, if successful upload, the system should remove the image/file from block storage (Instance storage) and replace the URL with your Cloudflare+S3 URL (in this case workhomeshop.site).
The plugin we are going to install is Media Cloud.
Go to Plugins -> Add New -> Search for Media Cloud -> Install and Activate.
Follow the Setup Wizard. If it not start, you can manually start it from Media Cloud -> Setup Wizard.
Click Next.
Select Amazon web services.
Click Next.
Insert your Access Key and Secret key (The ones you got when you created an S3 user). Insert your FQDN for your bucket.
Click Next.
Click Start Tests.
If you have done everything correctly. You should pass all the tests.
Click Next.
Click Finish & Exit Wizard.
Now go settings (Media Cloud -> Settings)
Make sure Access Key and Bucket name look correct.
Tic for Upload Image, Upload Video File, Upload Audio File and Upload Documents.
Set Cache-Control to : public,max-age=2592000
Tic for Delete Upload files and Delete From Storage
Save Changes
You don't need to do any changes to IMAGE UPLOAD HANDLING.
You don’t need to do any changes to the SECURE URL SETTINGS
Under CDN SETTINGS we need to set the Cloudfront URL.
In previous steps, I set up a CNAME address in Cloudfront that points to S3. This is the address you should paste here. Don't forget to add HTTPS:// and / at the end.
Click Save Changes
*Note, in the previous step I used content.workhomeshop.site. I’ve changed it to img.workhomeshop.site. My S3 bucket is called img.workhomeshop.site, my Clodufront URL for images is called img.workhomeshop.site.
You don’t need to do any changes to the URL REPLACEMENT.
You don’t need to do any changes to the DISPLAY SETTINGS.
You don’t need to do any changes to the RESPONSIVE IMAGE SETTINGS
You are now done with the WordPress setup! You can now validate that everything is working by upload an image to your Media Library.
If the image is uploaded successfully You should see a small cloud icon on your image.
If you look at the image details. You should see information about the bucket and the URL Address to the image domain you have set up in Cloudflare.
You are now done with Amazon S3 + WordPress Setup!
If you have done all the steps above. Take some rest now and do something else before we continue.
15 — Setup WordPress + Backup + Amazon S3
Backup, an important step. You never know if when you need to restore your site. We are going to set up a backup to Amazon S3. A reliable backup solution. Which is both fast and secure. Amazon S3’s Storage Designed for 99.999999999% (11 9’s) of Durability.
The first step is that we need to do is create an s3 bucket, then a backup user, and then install and setup the backup plugin in WordPress.
Create an S3 bucket for backup
Login to your AWS console, go S3
Click Create Bucket
Set a bucket name ex backup.yourdomain.com
Click Create bucket
You have now created a bucket for your backup.
Create an access token for your s3 bucket
You have now created an s3 bucket for your backup. Now you need to create credentials. So that you can upload and delete backup from WordPress.
Log in to your AWS dashboard, in the top-left corner.
Click My Security Credentials.
Click Groups and then click Create New Group
Set a group name
Click Net Step
Search for S3 and Select AmazonS3FullAccess
Click Net Step
Review your settings
Add a new backup user.
Click Users and then Add Users
Set the backup user name and select Programmatic access
Click Next
Select your backup users' group
Click Next
Add a tag if you want or leave it blank.
Click Create Users
Copy and save Access Key ID and Secret access key. You need it for the next step.
Install and set up a backup plugin in WordPress.
The backup plugin we are going to install is UpdraftPlus.
Go to your WordPress dashboard, plugins, Add New and search for UpdraftPlus. Install and Activate.
Go Settings -> UpdraftPlus and select Amazon S3
Set automatic backup. Depends on how often you do update. But at least make a backup every month.
Add S3 Access Key and S3 secret key for your backup user and set s3 location to your backup s3 bucket.
Click Test S3 Settings
If everything works fine. You should see a pop-up like this.
Click Ok
If you have added a backup scheme (backup every month). Activate email report.
IMPORTANT click Save Changes
Make your first backup! Gp to backup/restore
Click Backup Now
If this is your first backup. Select Only allow this backup to be deleted manually.
Click Backup Now
Follow the backup progress
When the backup is completed you should see the following pop-up.
At the bottom, you can see a list of your backups.
You are now done With the setup of WordPress + AmazonS3 backup!
16 — Setup RankMath (Rank Math SEO — Best SEO Plugin for WordPress)
SEO is important but it's also very complex and there a lot of information on how you can improve WordPress SEO. But if you just want to set up the page have a baseline. I suggest you install Rang Math.
Go to WordPress dashboard, Add New Plugins, Search for Rank Math, Install and Activate.
Follow the setup screen or just go to settings for Rank Math settings.
Enable follow settings
- SEO Analysis
- Sitemap
- WooCommerce
- Link Counter
- Redirections
- Schema (Structured Data)
- Analytics
17 — Enable Site Kit by Google — Analytics, Search Console, AdSense, Speed (recommended)
Google has released a WordPress plugin. The plugin makes it super simple to set up Analytics, Adsense, Pagespeed, etc with only a few clicks.
Go to WordPress Dashboard, Plugins, Add New, Search for G site, Install, and Activate.
Go Site Kit and enable services.
18 — Add 2-factor authentication to WordPress (recommended)
Thinking about security is important and there are several ways to secure your WordPress. I really recommend setting up 2-factor authentication.
Be sure to choose a system that does not take up too many resources from your server. I recommend the following by David Nutbourne + David Anderson, original plugin by Oskar Hane.
Install 2-factor authentication
Enable 2-factor authentication
19 — Customize the look of the page, update texts, and put a logo on the page.
We are now almost done with the website. Let’s make the final touch
Update Colors
Go to Appearance -> Customize.
It is so simple to customize the look. You can do all the changes from here.
Set your own custom color for your website.
Click Publish when you are done.
Update Logo
Go to Header -> Logo & Site Identity.
After the update, Click Publish
Tips. Creating a logo is not always easy. Can therefore recommend using the iOS app Vintage Logo.
Update Text on the front page
When you are logged in on your WordPress Dashboard.
Click the Edit page in the header menu.
Write a short presentation about your website.
20 — The Final settings in Cloudflare.
We are almost done now!
Now let’s make sure the page redirects to www.yourdomain.com and does not use the root domain.
The page loads extra fast by caching as many of the files as possible in the Cloudflare CDN network.
We start with the image domain.
Go your image domain
Click Page Rules
Click Create Page Rule
We want images to be cache forever, both in Cloudflare CDN and local on visitors' computers.
- Create URL match for everything
- Set Browser Cache TTL to a year
- Cache level to Cache Everything
- Edge Cache TTL a month
Paid Cloudflare plan gives more options
Click Save
Should look like this when you are done.
Change for the default website.
Go to your website domain.
Click Page Rules
Click Create Page Rule
- Create URL match for everything
- Set Browser Cache TTL to a year
- Cache level to Cache Everything
- Edge Cache TTL a month
If you have a site that updates often. Change TTL to 1 day or more. Depends on your content.
Click Save
We want to use www in front of our website, always.
Don't forget to add /* and then /$1
Click Save
Should look like this.
You are now done with cache settings for Cloudfront.
You can also create some custom firewall rules to protect your /wp-admin and block spam robots. But that will be covered in another article. So make sure to follow me. 😀
Thank you for your time — I hope you enjoyed this
I hope this article will be helpful to you. It has taken quite a long time to write everything down. I have tried to make everything as simple and straightforward as possible. With pictures and comments for each step so that anyone can do this.
Rember to follow me. I will write more about SEO, Dropship, Affiliates, WordPress, Making Money, and other stuff.
Frequently Asked Questions.
How do I access my EC2 instance from Linux, Windows?
Great article here
- https://www.clickittech.com/aws/connect-ec2-instance-using-ssh/.
- https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/putty.html
- https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstancesLinux.html
Why do we not want to expose our EC2 instance IP to the internet?
It’s very common when the user launches their first website on EC2, they point DNS name directly to the server and then, later on, maybe add a CDN service in front of the website later. The problem with this is that when you have exposed your IP together with your DNS name. The information (your EC2 instance IP) will within a very short time be listed on services like https://securitytrails.com/. And that information can be used for intrusion attempts. And of course, we want to avoid that situation for your autopilot-money-machine-website®. Of course, you can change the IP on EC2 after you have connected a CDN, but you will probably forget about it and suddenly you have a stream of strange traffic to your EC2 Instance, and suddenly you’re out of business. A bit exaggeratedly written, but security is important and there are those who find it fun to destroy other people’s creations. Always be careful about your information on the internet.
Where do I buy my domains?
I often start with this site or namecheap.com to see if I can find any discount on domains. After 6 months I always transfer them to Cloudflare. Why? I get free DNSSEC on Cloudflare, and the yearly price often very good at Cloudflare.com and I like to keep all DNS settings in one place.
Why Do you want to use Cloudflare for your WordPress site?
It’s probably the most simple way to add SSL to your website but you also get the best-in-class CDN service with great features that will improve your site speed and availability. Your site will also get DDoS protection and firewall features that come in handy when you install a WordPress site on Amazon EC2.
Why use CDN in front of Amazon S3?
Well, there is one thing you should know about. And that is up-stream and storage is a low cost. But download from Amazon S3 is a little expensive. So to avoid high traffic cost for S3 you basically add a CDN in front of the S3 bucket. It can be Cloudflare, CloudFront, Akamai, Level3, etc most CDN providers support Amazon s3. There is also another reason, you should never expose a backend service on the internet.
How to work with the site and by-pass the Cloudflare Cache?
When you have Cloudflare in front of your website. Your site will be cached. This can create problems when you update the site. Make sure you always enable Development Mode in Cloudflare.
How to fix Bitnami Error! ionCube Loader Not found.
sudo wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gztar xvzf ioncube_loaders_lin_x86–64.tar.gzphp -v
sudo cp ioncube/ioncube_loader_lin_7.4.so /opt/bitnami/php/lib/php/extensions/sudo nano /opt/bitnami/php/etc/php.inizend_extension = /opt/bitnami/php/lib/php/extensions/ioncube_loader_lin_7.4.sosudo /opt/bitnami/ctlscript.sh restart