[generate-title]
WordPress is still the most used content management system out there. It is a great instrument to create a fast, secure website for a short amount of time and little money. I have several WordPress websites from 1K user per month to 100K+ users per day. Despite the difference of the user base, the websites share the same configuration and are made to rapidly grow and expand.
In this article, I will walk you through how to create a WordPress website from scratch in three parts. The first part is registering a domain and setting up a cloud server with Amazon Web Services. Then, in the second part, I will show you how to optimize with cache plugins, CDN and other optimizations to work as fast as possible. In the final part, I will guide you on how to set up analytics to measure your success. We are going to integrate Google Analytics and connect it to Google Search Console. There is also a Bonus part with additional advice that will help your business
Using a lot of plugins will harm the page speed and that is why we will use a few that are essential for good work. Everything else we will do with a little bit of coding which is nothing scary nor hard. I created this document for personal use and now I want to share it with everyone who wants to create a website for personal or business use. Now it takes me less than a day to create a new website and the costs for small traffic (several thousand per month) in the first year are $0.50.
Content:
- Part 1 – Domain and Hosting For The Website
- Part 2 – Speed Optimization
- Part 3 – Analytics and SEO
- Bonus
- Conclusion
Part 1 – Domain and Hosting For The Website
Hosting Plans
Before starting with the WordPress installation we have to choose the right hosting provider and a domain name. Most hosting providers offer both of these and usually, there is a discount for new clients.
There are different hosting plans for specific needs. Every one has its pros and cons.
1. Shared Hosting
Many people use shared hosting because they are cheaper. The downside is that all domains on the server share the same server resources – RAM (Random Access Memory) and CPU (Central Processing Unit). I have used Hostinger on one of my firsts websites. At first, it was ok, the setup was really easy, literally with 2 clicks, but after we started gaining more visitors we constantly had problems with our website in terms of loading and availability. We didn’t have control and had to uplift our hosting plan which was not cost-effective.
2. Virtual Private Server (VPS) hosting
A VPS hosting is in the middle between the Shared and Dedicated server. It gives to the owners more control. Each website is hosted within its own space but it still shares a physical server with other users.
3. Dedicated Server
In this scenario, you are renting a physical server. You can have a full control. This is the highest level of a server that the biggest online businesses with millions of traffic per day use.
4. Cloud Based Web Hosting
This technology lets hundreds of individual servers work together as one giant server. The advantage is that if you get an unusually large amount of website traffic the hosting plan can accommodate the surge of traffic and protect the website from shutting down.
5. Colocation Web Hosting
Colocation Web Hosting means that you will have to buy your own server hardware and take it to a data center. They will take care of cooling, physical security, and internet access. This option requires unnessacary investment of time, money, and expertise for most businesses.
6. Self Service Web Hosting
This means that you will have to do it all yourself. Similar to colocation web hosting, this option is not recommended for and it is beyond the scope of what you’d want to do as an online business owner.
Why Amazon Web Services
As I said I have experience with Hostinger as well as a local provider – SuperHosting. It was the easy decision to start with a shared hosting plan but after we started to gain users and we went from several hundred to tens of thousands of users per day we had to migrate. This migration happened several months after we started and it wasn’t easy to set up everything. We had to export the entire website and import it to the new host. This time we decided to make things. We needed a server that will give us more control, we needed a CDN (Content Delivery Network) for our images, custom emails, and eventually, the option to separate the database as well. After doing some research we stopped at Amazon Web Services. They are the biggest cloud computing platform and provide service to companies like Netflix, Facebook, Twitter, LinkedIn, etc. It gives us some really good advantages:
- a variety of EC2 ( Elastic Compute Cloud) Instances with different RAM and CPU that can be changed constantly;
- you pay for what you use or you can reserve instances and have up to 75% discount;
- provide multiple Regions so that you can launch Amazon EC2 instance in locations that meet your requirements;
- has a full range of services – hosting, database, storage, email, etc. This is very useful for our website because we will use S3 to create CDN (content delivery network) where we will store the pictures of our website for speed optimization. Also, it is possible to separate the database for additional speed optimization;
- the support is amazing. My personal experience with the support team is more than pleasant. We had some issues and our bill has grown 650 times in two weeks. I immediately contacted Amazon, explained everything and the investigation of my case began. For 2 months my payments were on-hold, it went to several management levels and eventually, they removed the whole bill and we didn’t pay a cent. This proved to me that Amazon’s customers come first.
A big downside is that you would need technical experience to install and set up everything about your website and the technical support is paid separately with a starting price of 29 USD per month. That is why I am writing this guide to help you install and set your WordPress website as fast as possible.
If you do not have an AWS account register here.
Register Domain Using Route53
The next step is to register your domain name. If you have purchased your domain from another provider you should contact them or log into your account and change the name servers.
- Go to AWS Route53.
- Choose a domain name and purchase it. The registration takes several minutes.
- Amazon will automatically create a hosted zone for your new domain. It is 0.50 USD per month for the first 25 hosted zones.
- Create a free account in Cloudflare, and add your website. Cloudflare will automatically get your name servers and will ask you to change them.
- Go back to AWS Route53 console and from the left menu choose Domains -> Registered domains and choose the newly registered domain.
Note: If your domain is purchased from another provider go to Hosted Zones and Create Hosted Zone with your domain name. This is not required in order to work on the website, but we will need it later when we are going to create a CDN that will store the images of the website. - Click on Add or edit name servers, delete the ones from Amazon and add the ones from Cloudflare.
Note: If you are on your hosted zones choose your newly created host zone and select NS type. From the box in the right delete the Value box and place the name servers from Cloudflare. - Cloudflare will perform a check if everything is okay and it should be ready after a few seconds, but in some cases make take up to 24 hours. If it takes longer you can jump straight to the next step and Create EC2 Instance for WordPress Website
Create EC2 Instance for WordPress Website
- Go to EC2 Dashboard.
- Choose the Region that you would like to create your instance. Choose Region that is closer to your potential users.
- Select Launch Instance.
- Search for “WordPress” in Amazon Marketplace and select WordPress Certified by Bitnami and Automattic
- Choose type – Amazon EC2 Instance Types
- Review and Launch. You can configure by your own Instance Details, Storage, Tags, and Security Group. Amazon uses default settings: 1 instance with 10 GiB of storage and creates a new security group.
- Before Launching you create a new key pair and download it. We are going to use it to access the server with SSH and do not share it with anybody.
- Click on your newly created Instance and below you can see different metrics such as CPU Utilization, Disk Reads. etc. On the bottom is CPU Credit Usage and CPU Credit Balance. Read more about CPU credits and baseline performance for burstable performance instances. This is important because the EC2 instances have CPU Utilization (baseline performance) and the limit is not 100%. I did not know that and I was wondering how come my t2.micro instance has CPU Utilization of 10% and my server is now working. After reading about CPU credits and baseline performance I understood that I had to change my instance type.
- For future use, you can change the instance type by: left click on the instance->Instance State->Stop. After that left click->Instance Settings->Change Instance Type.
- While the instance is starting, from the left menu go to NETWORK & SECURITY -> Elastic IPs. Allocate Elastic IP address, this will give us a constant IP because when we shut down our EC2 instance (the server) and start it again the public IP will change and it may cause troubles for our website. Creating an Elastic IP will make sure that our IP is always the same.
- Now Associate the Elastic IP with the Instance that we created.
- Copy the IP address and paste it into the search box of the browser. Now you have a brand new website. Save the IP for the next steps.
- Go back to Instances and select your instance. Actions->Instance Settings->System Log to get the auto-generated password for our WordPress admin panel.
- Find in the user name and password in a box of #.
- Copy your username and password and go to http://yourdomain.com/wp-admin and use the provided credentials to log in.
- This is the admin panel where you can manage your website, create and edit pages, install plugins, manage users, etc. If you want you can go to Users -> Your Profile and change your password with more familiar one.
Connect Cloudflare to Hosting
- Return to the Cloudflare dashboard and go to the DNS tab.
- Create a new record – this is telling that under your domain name is the IP of your instance:
- Type: A;
- Name: “domain name”;
- IPv4 address: the IP address of the EC2 instance
- TTL: Auto
- Proxy Status: Proxied
- Create a new record – this allows you to connect the server with FTP, we will use this in Part 2:
- Type: A;
- Name: ftp;
- IPv4: the IP address of the EC2 instance
- TTL: Auto
- Proxy Status: Proxied
- Create a new record – this allows your website to be accessed with www:
- Type: CNAME;
- Name: www;
- Target: “domain name”
- TTL: Auto
- Proxy Status: Proxied
- Now your domain name will point to the IP of your website and you should be able to access your newly created website with the domain name.
SSH Connection
Opening the front page you may have noticed in the down right corner a logo. That is the Bitnami logo and now we are going to remove it because closing it won’t remove it for other users. Now we are going to connect to our server with SSH connection. We will also use it to install an SSL certificate for our website.
- Follow the official guide from Bitnami “Connect To The Server Using SSH”. Go directly to “Connect With An SSH Client On Windows Using An SSH Key” (here we are going to use the key pair from our EC2 instance).
- After connecting to our server write this command line in order to remove the watermark from our website.
sudo /opt/bitnami/apps/APPNAME/bnconfig --disable_banner 1
Then with this command restart the Web Server.sudo /opt/bitnami/ctlscript.sh restart apache
Refresh your page with ctrl + f5 to see the changes. - To make the website secure we have to install an SSL certificate. Before that Go to Cloudflare dashboard, scroll down to Advanced Actions, and pause Cloudflare.
- Enter this command in the console.
sudo /opt/bitnami/bncert-tool
Follow the instructions: enter your domain name, www to non-www redirects, etc. - Resume Cloudflare.
- Now check your website and you should see the secure connection.
Connect to Server with FileZilla
FileZilla is a free FTP solution for both client and server. We are going to use it to access the files of our website.
- Download FileZilla Client and install it.
- Open it and from File choose Site Manager
- Click New Site with these settings:
- Protocol – SFTP – SHH File Transfer Protocol
- Host: Your EC2 instance IP
- Logon Type: Key file
- User: bitnami
- Key file: The PPK file you created with PuTTY
- Click Connect
- In the right panel, you will see the directory of the server. Navigate to bitnami -> apps -> wordpress -> htdocs. This is the main directory of your WordPress website.
- Download wp-config.php file because we will need to modify it later. This file contains configuration settings for the website.
Part 2 – Speed Optimization
One of the main advantages of WordPress is its own market with plugins that will help you add more features to your website without coding. For this part, we are going to use several plugins.
Caching with W3 Total Cache
Caching is the process of storing frequently-accessed data temporarily in a cache which makes the website a lot faster.
When someone is visiting a page on your site, they need to request information from the host server. These requests include styling, scripts, images, fonts, etc. In addition to this, the user also needs to retrieve content that’s stored in your WordPress database, e.g. posts and pages. Caching tells the browser to cache those files for a period of time. Every time the users visit the same page they will already have the files and the loading of the page will be a lot faster.
- In your admin panel at “yourdomain.com/wp-admin” from the left menu select Plugins->Add New
- Activate it
- Open the wp-config.php file. Write this line of code:
define('WP_CACHE', true);
Write it after:
$table_prefix = ‘wp_’;
define( ‘WP_DEBUG’, false ); - Save changes and upload the wp-config.php file on your server.
- A new icon on the left menu has appeared, from there you can access the plugin settings. Select Performance -> General Settings and scroll to the bottom of the page to Import/Export Settings. To make things easier I have exported my settings in a JSON file. Download the file below, extract it, and import it into Import Configuration. Then click Upload. This will activate Page Cache, Object Cache, Fragment Cache from Disk, Cache feeds, Set expires header, Set cache-control header, Set W3 Total Cache header, Prevent caching of objects after settings change.
Download W3 Total Cache Settings
Read more about the settings here: How To Make WordPress Faster With W3 Total Cache + Cloudflare
5. From Extensions Activate Cloudflare Extention and click Settings. - Go to the API Tokens of your Cloudflare Account.
- Copy your Global API Key.
- Return to the Cloudflare settings in WordPress and authorize your website with your Cloudflare’s email and the Global API Key.
- Return to the Cloudflare dashboard.
- From the menu on the top and click Page Rules.
- Create 3 new page rules.
The first two will prevent Cloudflare from caching your admin panel on WordPress and the preview pages when you are editing.
The third rule is recommended when you have a lot of traffic. Enable it when your server is slowing down due to high traffic. It does the following two things:- Edge Cache TTL is the setting that controls how long CloudFlare’s edge servers will cache a resource before requesting a fresh copy from your server. Depending on how frequently you update the website, choose a time that suits you best.
- Browser Cache TTL is the time that Cloudflare instructs a visitor’s browser to cache a resource.
- Cache Everything will cache even dynamic elements from your website. Keep in mind that this will cache everything on your website and when you make a change you should purge the cache.
- Make sure that Not caching rules for admin panel and preview pages are the first and second rules.
I have disabled Cache Everything for this website because the traffic is not that heavy. - Click on SSL/TLS tab and make sure that Your SSL/TLS encryption mode is Full.
Autoptimize
This plugin will optimize CSS, JS by removing the white spaces and combining them into one file. Keep in mind that it may break your theme some of your other plugins. If something is not right after installing Autoptimize revert the changes.
- Select from the left menu Plugins->Add New
- Search for Autoptimize
- Install and Active the plugin
- Go to settings
- Enable Optimize JavaScript Code, Optimize CSS Code, Optimize HTML Code.
CDN with Amazon S3
- Log in to the AWS Console
- Navigate to Amazon S3 Console. Here you can create buckets to store files. In this case, we are going to create a new bucket for our WordPress site.
- Click Create bucket
- Name it “cdn.yourdomain.com”.
- Select your bucket, choose Permissions -> Bucket Policy, and paste this JSON object.
{
“Version”: “2008-10-17”,
“Statement”: [
{
“Sid”: “AllowPublicRead”,
“Effect”: “Allow”,
“Principal”: {
“AWS”: “*”
},
“Action”: “s3:GetObject”,
“Resource”: “arn:aws:s3:::cdn.yourdomain.bg/*”
}
]
}
This will make your bucket public for read in order to get images from it and display it on your website.
Note: On the Resource field enter your bucket name. - If you upload a file in the bucket and open it, you will see that the URL is in this format https://s3.(region).amazonaws.com/cdn.yourdomain.com. This is not a friendly SEO URL. To make it only cdn.yourdomain.com we have to create a CNAME in Cloudflare. Go to the Cloudflare dashboard -> select your website -> DNS.
- Create a new record:
- Type: CNAME;
- Name: “cdn”;
- Target: yourbucketname.s3.amazonaws.com
- TTL: Auto
- Proxy Status: Proxied
- Navigate to the IAM Users page in the AWS Console
- Click Add User
- Enter a user name and choose Programmatic access
Names are case insensitive and must be unique within your AWS account. User names can be a combination of up to 64 letters, digits, and these characters: plus (+), equal (=), comma (,), period (.), at-sign (@), and hyphen (-). - To allow the new user to manage buckets and objects in the S3 service, you need to grant it specific permissions. Click the Attach existing policies directly and click Create Policy
- Click JSON and enter the following JSON object.
{
“Version”: “2012-10-17”,
“Statement”: [
{
“Effect”: “Allow”,
“Action”: [
“s3:CreateBucket”,
“s3:DeleteObject”,
“s3:Put*”,
“s3:Get*”,
“s3:List*”
],
“Resource”: [
“arn:aws:s3:::cdn.culinaryinspiration.bg/*”
]
},
{
“Effect”: “Allow”,
“Action”: [
“s3:ListAllMyBuckets”,
“s3:GetBucketLocation”
],
“Resource”: [
“arn:aws:s3:::*”
]
}
]
}
This will create a permission for the user to Get, Delete, Update, and List objects from the bucket.
Note: On the Resource field enter your bucket name. - Enter the policy name and description and create it.
- Return to add user and search for “s3” in the filter policies input box. Select your newly created policy. Then click the Next: Tags button at the bottom of the page.
- Review and Create the user
- You will be shown the security credentials. We will need them to upload the images from WordPress to S3. Copy them and download the CSV file in a protected place.
- The next step is to define the S3 settings in the wp-config.php file as we did with the W3 Total Cache plugin. Open wp-config.php file and place this line of code:
define( ‘AS3CF_SETTINGS’, serialize( array(
‘provider’ => ‘aws’,
‘access-key-id’ => ‘********************’,
‘secret-access-key’ => **************************************’, ) ) );
It should be placed before the following block of code in your wp-config.php. Otherwise, WP Offload Media won’t be able to read it.
if ( !defined(‘ABSPATH’) ) define(‘ABSPATH’, dirname(__FILE__) . ‘/’);
Replace the stars with the Access Keys from the previous step.
The keys on the screenshot are fake. Protect them and do not expose your access and secret key! - Save changes and Upload the wp-config.php file on your server.
- Now let’s install the plugin and activate it. From your admin panel in WordPress select Plugins -> Add New
- Search for WP Offload Media Lite, install it, and activate it.
- The icon will appear in the left menu under Settings. Select it and enter your bucket name.
- Enable Custom Domain and Force HTTPS
- Everything is set up. Let’s test if everything works fine. From the left menu in WordPress select Media -> Library.
- Add a new image.
- Choose the image that you have uploaded and check the copy link. It should be from your CDN.
Speed Test
We are ready with the Speed Optimization, now let’s check the speed of our website. There are two free online tools that analyze the page’s speed performance: GTmetrix and Google PageSpeed Insights. Run both tests and see the grade of your website. Google PageSpeed Insights shows poor results on websites that are made with page builders, drag, and drop builders such as Elementor, WPBakery, Divi. Do not despair if your site is built with page builder and shows low results.
Keep in mind that Google PageSpeed Insights is suggesting to you what to correct on your website. These recommendations are not a must, for example, the image format should be WebP, but not all browsers support that format. Also, it may say that the DOM is too large, but that depends on the theme of the WordPress website. Of course, 100 points is all we want and it would be nice to have it in order for our users to have the best experience on our website.
A big advantage is that PageSpeed Insights run a separate test on mobile and desktop. My advice is to focus on mobile because when Google is ranking your website in Google Search it checks first (if not only) your mobile versions.
Part 3 – Analytics and SEO
Google Analytics
The most common tracking tool is Google Analytics. It will help you make better decisions by providing stats and data for your users. Such statistics is traffic source, page visited, time visited, number of sessions, duration, etc.
If you sell online you can create custom tags and keep track of your sell funnel.
Important Notice: Do this after you have chosen a WordPress theme because we are going to modify one of the theme files and if you change the theme the changes won’t be there anymore.
- Log into Google Analytics with Google Account.
- Click Start Measuring
- Enter your Organization Name
- Choose that you want to measure Network.
- Enter your website name, choose https as a connection, enter your domain, category, and time zone.
- Now your Google Analytics account is ready. Let’s connect it to your website. Copy the code given.
- Open WordPress admin panel and from the left menu select Appearance->Theme Editor and from the theme files select functions.php. On the top of the document place the following block of code after <?php
add_action(‘wp_head’, ‘google_analytics’);
function google_analytics() { ?>
CODE YOU COPIED FROM GOOGLE ANALYTICS
<?php }
This piece of code adds 2 scripts in the header of your website. These scripts are with your id from Google Analytics. Note that Google Analytics may not provide 100% accurate statistics because AdBlocker extensions will block these scripts. - Update File
- From the top menu select Purge All Caches. This will delete the cache of your website and the changes will take place.
- Go to the home page of your website and Google Analytics Dashboard. You will see 1 user on your page.
Google Search Console
Search Console tools and reports help you measure your site’s Search traffic and performance, fix issues, and make your site shine in Google Search results. It gives information about the kind of keywords your website is shown, how many people click on it, on what position is your page and other helpful information.
- Navigate to Google Search Console
- Enter your domain name
- Copy the code that Search Console is giving. We will use it to create a DNS record in Cloudflare. That way Google will authenticate that you owner of the domain.
- Log in your Cloudflare account and go to DNS tab
- Create a new record:
- Type: TXT;
- Name: @;
- Content: Code from the Google Search Console
- TTL: Auto
- Click Save
- Return to Google Search Console and click AUTHENTICATION
- Now your website is in your properties.
SEO – Search Engine Optimization
The fuel for every website is its users. One of the ways to get more users is from search engines like Google, Bing, Yandex, Ecosia, etc. Ranking higher means more visits to your website that is why Search Engine Optimization is a must for every website.
Fortunately, there is a plugin that will automate the coding part and will help us when creating content for our website.
Yoast SEO is the plugin with most installs on WordPress. It has a free version and a paid one. I have only used the free version and it has its limitation
- only one keyword per post/page
- no redirect manager for moved pages
- has ads
Recently I started using another plugin that is growing fast – Rank Math. The plugin itself is more lightweight, fast, efficient and it’s completely free, and you can use up to 5 keywords per post/page.
Rank Math Integration
- You will need to create a free Rank Math account
- From Plugins -> Add New and search for Rank Math. Install and Activate it.
- It will take you to the Set-Up page. Click Activate Rank Math and log in to your account.
- Click Get Authorization Code. Give Permission to Rank Math for your Google Account and copy the code. Select your website and continue.
- Save and Continue SITEMAPS and SEO Tweaks as they are.
- Continue and your website is ready.
Bonus
Monthly Budget in Amazon Web Services
In Amazon Web Services you pay for what you use. What we have done so far is controlled and it is easy to calculate your expenses, but this doesn’t mean that crazy things can’t happen.
Amazon has amazing service and support, but to make sure everything is ok I recommend creating a Monthly Budget. This Monthly Budget is simply a notification when your bill reaches a certain amount.
Custom Email
There are two ways to create Custom Email ([email protected]) for your business.
The first option is using Amazon WorkMail. It is a secure, managed business email and calendar service with support for existing desktop and mobile clients. Amazon WorkMail gives users the ability to seamlessly access their email, contacts, and calendars using Microsoft Outlook, their web browser, or their native iOS and Android email applications. The price is not cheap though, $4 per month for each user.
The second option is using Amazon SES. It is far cheaper but it’s more complicated to configure.
Amazon has documentation on how to Forward Incoming Email to an External Destination. The documentation includes how to:
- set up your domain in Amazon SES
- configure S3 bucket to receive your incoming emails
- create a Lambda Function to forward the received email to another mail provider, I use my Gmail.
- create a Receipt Rule Set, in other words, to define mails that you will use. Such as [email protected], [email protected], etc.
After you have set up your domain and Amazon is forwarding the emails, we have to be able to send emails from our newly created email address.
For Gmail users:
- Navigate to your Gmail account
- Go to Settings
- Select Add another email address
- Type your Name and Email Address
- Gmail will automatically find the SMTP Server and Port
- Click Add an account
- Click to write a new email and now you have several options in From field
- Repeat for as many emails you have.
Image Optimization
If you are not a photographer or a designer you will need to reduce the size of the images for your website. Here are several options that I have used and worked fine:
- TinyPNG is a website that compresses PNG and JPEG images. The free version supports a maximum of 5 MB images.
- Smush is a free plugin for image optimization. It offers 3 levels of compression. It has a pro version that converts your existing images to WebP format.
- Shortpixel is another plugin that has a free version for 100 images per month and it converts to WebP for free.
Conclusion
This is the complete guide on how to register a domain, create a server, optimize your website, and analyze the traffic. Website optimization and maintenance is an everyday job but with the time you will find what works best for your needs.
Share what you think of this guide in the comments below. Also, if you have any questions about this or anything tech-related feel free to comment below or write to me at [email protected].
4 Comments
Nancy
Really useful! Thank you for the article! It really gonna help me in the future! Amazing!!!
Plamen Metodiev
Hello Nancy, thank you for your feedback! I am glad that you find this article useful. If you have any questions please feel free to contact me and I will try to help you with your website.
Panagiotis Kontogiannis
Instead of W3 Total Cache I would use the much better WP Rocket caching plugin and instead of rank math I would put The SEO Framework.
Charles Palmberg
Wow, awesome blog layout! How long have you been blogging for? you made blogging look easy. The overall look of your site is great, let alone the content!