Is it even possible to host a blog that can handle millions of visitors on shared hosting? The answer is YES, it is possible to make a blog handle millions of visitors on shared hosting.
So, you might be thinking how is it even possible to do something like that. Like how can a shared hosting handle that much traffic? Well, the answer is easy.
We use a proper WordPress setup with all the things we need like caching and cdn to make a simple blog that can handle that much amount of traffic.
Note: You can only make a blog handle that much traffic if it has less dynamic content. For example, our site netmiko.com has very little dynamic content.
Why shared hosting is enough for a Blog –
Shared hosting is something that many people think is trash and very slow and unreliable. But with proper caching and cdn you can make a shared hosting work like a VPS.
With the usage of proper caching and cdn, I was able to make my blog that is hosted on HostGator shared hosting handle 5000 users per second. Yes, that’s right “per second”.
Now, If you compare it to a blog that is hosted on shared hosting without cache and cdn then that blog will barely be able to handle 5 users per second.
Now again I want to tell you that these methods will only work if your blog is not very dynamic. Like the only thing that is dynamic on our blog is the search bar. And everything else is static and remains the same until I publish a new blog post.
Now let’s see how we can make a simple WordPress blog handle millions of visitors on shared hosting.
Choose web hosting and Install WordPress –
The first thing we will need is reliable shared web hosting. There are lots of shared hosting companies out there but I recommend you to use HostGator which is reliable and fast.
One web host that I don’t recommend is hostinger. I had one hell of a horrible experience with their shared hosting. So whatever you do, don’t fall for their marketing tricks.
You can use either HostGator or Bluehost shared hosting for your blog.
We need shared hosting that can handle the sudden traffic surge.
Now, after you have bought the web hosting you will need to install WordPress in it. During WordPress installation make sure to unselect any bloat plugins that are installed during a WordPress installation by default.
Because we want a bloat-free WordPress installation, which is faster.
Setup a Cloudflare account –
Now, we will need to create a Cloudflare account and add our site to Cloudflare. Cloudflare will help in handling all the traffic instead of our web hosting.
If you don’t know what Cloudflare is and how it works then here is a simple explanation.
So, basically, Cloudflare is a content delivery network (CDN) that stores and distributes the content of your website around the world.
Meaning that all the contents of your website will be stored in different Cloudflare edge servers around the world and whenever a user visits your website then instead of fetching the contents of your site from your origin server the contents will be fetched from Cloudflare servers.
This means that your web hosting won’t need to handle that traffic because it will be handled by Cloudflare.
1. To set up a Cloudflare account first go to cloudflare.com. Now, click on Sign UP.
2. Enter your email and enter any password and click on create an account. After that, you will need to select Cloudflare for infrastructure.
3. Here you will need to enter your domain name. After that, you need to scroll down and select the free plan.
4. In Review DNS records scroll down and click continue. Now in Change your Nameservers you will need to copy the Cloudflare nameservers.
5. Now go to your domain name provider from where you bought the domain name. Then go to Nameservers. Here remove the default nameservers and add the Cloudflare nameservers and save it.
Changing Nameservers can be different for different companies so make sure to google it.
6. Wait a few minutes for DNS to propagate.
7. After adding the nameservers in your domain Registrar go back to Cloudflare and then click on “Done, check nameservers”.
8. Now in the QuickStart guide click on “get started”. After that Turn on all the options and click save. Then click on Finish.
It might take a few minutes to a few hours for DNS to propagate so check your Cloudflare dashboard after a few minutes. Here you will see a notice if Cloudflare is connected successfully.
Your Cloudflare account is created so now let’s continue to the next step.
Install and Setup WP Cloudflare Super Page Cache –
Now to control the caching of Cloudflare we will use a lightweight plugin called “WP Cloudflare Super Page Cache”. You can search for it or download it from here.
After downloading the plugin install it and then activate it.
You can access the WP Cloudflare plugin from settings>WP Cloudflare Super Page Cache.
1. Once you are in the setting of the plugin. Scroll down a little bit and then here you will need to add your Cloudflare email and Cloudflare API key.
2. To get the API key go to cloudflare.com and then Log In using your email. After that select your site.
3. Now after selecting your site you will be in the overview so scroll down a little and on the Right side, you will see an option that says “Get your API token” click it.
4. Here scroll down a little and there you will see “Global API Key”. On the right side of it, you will get the View option. Once you click the View option Cloudflare will ask you for your password.
After entering the password you will get the API key which you will need to copy. Note: Don’t share this API key with anyone.
5. After copying the API key go back to WP Cloudflare Super Page Cache settings and then paste the API key and enter your email id of Cloudflare, then click Update settings.
6. Now here you will need to scroll down and click on “select a domain name” and then select your domain. Then click on Update settings.
7. After that here Click on “ENABLE PAGE CACHING NOW”. The plugin setup is now complete. To test that click on “TEST CACHE”.
If it says that page caching is working correctly then it means that Cloudflare cdn is now enabled on your site.
You can change some settings you don’t want from WP Cloudflare Super Page Cache settings. But I would recommend keeping the default settings as they work on all kinds of blogs.
Your site can now handle millions of visitors per month on shared web hosting.
But there is still one more thing that needs to be set up to avoid crashing your site. And that thing is images.
Setup CDN for Images –
Now, the problem with Cloudflare is that whenever you clear the cache of your website then all the cached images, HTML, js, CSS of your site will be cleared meaning that Cloudflare will request all the resources of your website from your webserver until its cached in Cloudflare again.
This means that there will be a surge in resource usage which can crash your website. This is not a problem with sites that don’t contain images in them, but if your site contains lots of images then you will need to use an external cdn for images.
So, if you use an external image cdn then even if you clear the cache for your website Cloudflare will only be able to clear the cache of the Html, CSS, and js and not the images because the images will be served from an external cdn that Cloudflare has no control on.
This means that all the Html, CSS, js will be served through Cloudflare and the images will be served through an external cdn which means that the load on our web hosting will be very low.
Now, let’s see how we can add an external image cdn. We will be using statically image cdn in our blog. You can see the full tutorial of how we can use statically cdn on our WordPress blog.
1. To set up statically cdn for our blog we will first install the statically plugin. You can search for it and download it from here. Install and then activate the plugin.
2. To start the setup click on the statically plugin icon in the admin menu. Now here you will need to generate a Statically API key. That you can get by going to this link here.
4. After that copy the API key shown there and then go back to statically plugin settings and paste the API key. After that click on save changes.
And that’s it, your images will now be served through statically image cdn instead of your origin server, and clearing the Cloudflare cache will not affect it.
By default, the Image files will be cached on the CDN for 1 year.
Now let’s take a load test of our website to see how much load it can handle.
Load test the blog –
For load testing our website, we used Loader.io. Which is a free load testing application that tests our website using thousands of concurrent connections.
To begin, I created an account in Loader.io and selected their free plan.
After that in Target Host, I added my domain name and verified it using a txt file.
Then I created a new test where in Test Type I selected “ Clients per second “ and the number of clients per second was 500. It’s like 500 users visiting your site at one time per second.
The test ran for 1min with 500+ users per second doing HTTPS get requests. The average response time was below 600ms and there were 0 Timeouts. This means that this setup can easily handle millions of visitors per month without any problem.
You might see a high response time in the beginning but after that, the response time gets stable and goes lower once the page is cached properly.
And that’s how you can make a Blog handle millions of visitors on shared hosting.
If you liked this post then do make sure to share it with your friends and also make sure to comment down below. If you face any problem or have a question then comment down below or dm me on Twitter or Instagram.