Welcome back to my another blog post. Today I am going to share my experience hosting my websites. We will explore different options available in the market, their pros and cons and which option to pick and at what stage. I will also talk about my mistakes and lessons learned over the years. I hope this will act as a reference for someone out there thinking of hosting their first website. So, let's get started.
By 2013, I was making dynamic websites using PHP and MySQL database and in 2014 I created my first website dyclassroom.com, an educational website. Over the years, I have deployed simple static websites, custom dynamic websites, websites using CodeIgniter framework, WordPress websites and blogs, websites built using React, Next.js, monoliths and microservices etc.
I prefer to learn new skills by doing projects and therefore my requirements are the following.
|Pocket friendly||Hosting plan should be pocket friendly. Back in college I was using my pocket money and now I am using my salary to fund my projects and experiments.|
|Sandbox environment||I need a hosting plan that allows me to spin up machines quickly and easily so that I can deploy my code. It should also allow me to easily delete the machines when I am done.|
|Web hosting||Hosting plan should allow me to host multiple domains and subdomains.|
|SSL certificate||Should have free SSL certificate option for domains and subdomains.|
|Games||Hosting plan should have option to host simple HTML Canvas Games.|
|Preview URL||Hosting plan should offer Preview URL for websites so that I do not have to buy and map domain names for every test projects.|
Back in 2013-14, there was a website called c9.io, which got acquired by Amazon in 2016. They had a free tier which allowed PHP website hosting. So, I signed up for a free account to get a feel of how a real hosting looks like and what real life challenges are involved in developing and hosting websites.
Once I had a good practical knowledge of web hosting, I purchased my first shared hosting plan in 2014 from HostGator India and it costed me about three thousand Indian Rupee after discount. Since then I have tried shared business plans, VPS (Virtual Private Server), Cloud Hosting like Vercel, AWS (Amazon Web Services) and GCP (Google Cloud Provider).
Following chart shows my total annual web hosting expense from 2014 to 2022. It is over INR 383k. And it does not include SSL certificate cost, domain purchase and renewal costs, cost of installing SSL certificate via tech support, etc. Till 2017, I was using shared hosting. In 2018, I migrated to VPS and discontinued the shared hosting. Till 2022, my per annum hosting cost was INR 65k.
If you have been hosting websites for a very long time then you would know that SSL certificates were a paid thing. Now it is free all thanks to options like Let's Encrypt SSL.
In 2023, I rewrote my websites from PHP to TypeScript and moved to GCP. This transition has helped me in reducing the hosting cost significantly. More on this at the end of this blog.
In the following sections I will share with you my personal experience using different hosting plans.
Shared hosting plans
Imagine, we have a server with 4vCPU and 32GB RAM and imagine we are hosting 10 websites on that machine. This is shared hosting, multiple websites running on a single machine, sharing resources and sharing hosting expense. This is one of the reasons why shared hosting plans are cheaper.
Shared hosting plans are really great for someone who is just starting out. Most of the hosting providers offer Click-and-Install WordPress option and cPanel to manage the website and database.
There are so many tutorials and blog posts and YouTube videos on "How to setup WordPress website on HostGator". You can follow any of them and get your website up and running in no time.
Now, let us look at some of the pros and cons of shared hosting. Following are some of my personal experiences.
Shared hosting plan - Pros
- Less expensive. We can find an affordable plan within INR 5000 p.a.
- The backend infrastructure is fully managed by the hosting provider.
- We can easily connect our domain name to our hosting plan.
- Comes with easy WordPress installation option.
- Comes with cPanel, a control panel software, that makes managing our website easier.
- Free SSL certificate via Let's Encrypt.
- MySQL/MariaDB database
- phpMyAdmin for MySQL/MariaDB.
- Free Email accounts with our domain name.
- Easily connect to the shared hosting server using FTP clients like FileZilla, CyberDuck, etc.
- Most hosting providers have PHP support as WordPress is one of the most popular offering.
- We can deploy custom PHP projects built from scratch and PHP project built using PHP frameworks with some initial setups and configurations.
- 24x7 tech support
Shared hosting plan - Cons
If your website becomes popular and attracts more traffic or you want more features then you may have to upgrade your hosting plan. Following are some of the cons that I have found over the years hosting my websites on a shared plan.
- If the website receives huge traffic spike then our account may get suspended.
- The resources (CPU and RAM) are shared by multiple websites that are hosted on the same machine. So, if a website gets a huge traffic, it will put an excess load on the machine and other websites may go down.
- WordPress is a popular CMS hence PHP is widely supported. Trying out new programming languages may not be that straight forward.
- Fewer database options - MySQL/MariaDB.
- On-demand scaling up/down is not an option. We have to buy a new plan and ask tech support to help us migrate our website and database. This will cost us and we have to go through downtime.
Self Managed VPS hosting
When our website becomes popular and it receives a lot of traffic then we can move to a bigger hosting plan and Self Managed VPS (Virtual Private Server) hosting is one of the option.
Self Managed VPS hosting - Pros
- Dedicated server - we decide how many websites we want to host.
- Bandwidth greater than 1TB which is good for blogs and websites that expects high traffic.
- Automatic regular backup.
- Dedicated IP address
- WHM (WebHost Manager)
- Free SSL certificate via Let's Encrypt.
- Quick install WordPress
- In VPS plan we can create multiple user accounts. Each accounts will be then mapped to a domain name and it will have its own cPanel. Basically, we become our own hosting provider for our websites.
- We get root access to the server. We can install softwares and run our experiments.
- 24x7 tech support
Self Managed VPS hosting - Cons
- Dedicated server will increase our annual hosting cost. So, check your budget.
- Self managed - we have to take care of most of the things. The hosting company will provide us the hardware and software to manage the hardware. Rest is on us.
- This is also a fixed machine. Hence it will not auto scale up/down.
- Being a fixed size machine means we keep paying a fixed price even if we do not use or under utilize the resources.
- Fixed database options like MySQL/MariaDB. We can install other databases as root user but it may break our system if we are not careful. This is not scalable.
- Fewer programming languages support out-of-the-box. I had a VPS which supported PHP. Even though I was able to successfully install/enable Node.js but for some reason it was not available via WHM or in cPanel from the domains. I followed video and tech notes from the service providers and other customers but had no success. The Node process just would not start.
- Running applications built using Next.js will require a lot of work. Not a good developer experience.
If you are looking for more control then following section explores some of the more advanced options.
Popular among start-ups and individuals who want to host their website and backend services. Great for Next.js projects. It provides a lot of options - databases, logging, CMS like Sanity, eCommerce like Shopify, SSL certificate, preview URL caching and much more. They use AWS infrastructure under-the-hood. Read more.
At the moment, they provide a hobby plan which is okay to get started. The hobby plan is good for hobby projects so, no commercial project or running promotions or ads. I tried it for few weeks. It was really awesome for Next.js application. They have a Pro plan as well which is USD 20 per user per month, at the time of writing this blog post. This is a little expensive for someone with a very simple requirement and a smaller monthly budget.
If you know how to code, build, deploy and manage your server then you can check out AWS, Azure and GCP and start managing your project all by yourself in the cloud. I know it is a lot of work but you will get more control over the resources and cost.
GCP - Cloud Run
Cloud Run is one of the suitable options to host our personal websites and blogs. We can use it in other use cases as well. Read more.
GCP - Cloud Run - Pros
- Pay for what we use.
- GCP provides good discounts on Cloud Run every month.
- Preview URL - good for testing our website without mapping our domain name.
- Free SSL certificate for the preview URL and for the mapped domain name.
- Easily connect our domain to Cloud Run service.
- Easy integration with our code repository.
- Easy Build and Deploy setup - It can easily integrate with Google Cloud Build (to build our Docker image) and Artifact Registry (which holds the Docker image).
- Options to integrate with other GCP services.
- Good for both simple and advance projects.
GCP - Cloud Run - Cons
- We have to manage everything - from development to deployment, reading logs and fixing bugs.
- Steep learning curve.
Compare the options
|Shared||Self Managed VPS||Cloud Provider|
When to use?
When to use?
When to use?
Mistakes and learnings
When my websites started to get more traffic, back in 2017-2018, I decided to opt for a VPS plan from a shared plan. It was an okay move at the time. Due to sudden spike in traffic my hosting account was suspended and I needed a hosting plan immediately to get my websites back online. VPS plan gave me more CPUs and RAMs and higher bandwidth which solved my problem.
However, if you ask me to do it all over again then I would prefer to move to a cloud provider like GCP or AWS or Azure. I have been developing, deploying and maintaining my websites all by myself so, cloud providers like GCP and AWS makes more sense to me and they also have Pay-as-per-usage billing and I can terminate and recreate a service any time I want.
I have been paying about INR 65k p.a. for the last 5 years for my website hosting and sandbox experiments. Please avoid this. If you know how to code and deploy and manage your infra then go for GCP or AWS. You will definitely save more money.
I am currently using GCP for web hosting and sandbox environment. My monthly expense has reduced by 90%.
As of now, Cloud Run is great for my web hosting needs. I am also using Google Compute Engine VM instances for my sandbox experiments.