
How to host a portfolio website as low as 2 USD/month on ec2.
3 min read
·
May 22, 2023
--
Well there is no denying that as we are using complicated system to host our portfolio website. So, today I am going to guide how to host a website with our own code so that creativity comes first rather than being scared of making complicated system so let’s start with the journey how I hosted portfolio site rijalnitesh.com .
So, here I have used namecheap as Domain register or to register my domain.
Then I have launched ec2 instance with free-tier eligible service i.e. ubuntu server and t2.micro 1 virtual cpu and 1 GB RAM and 20 GB storage.
While allowing all rules in outbound rule and only allowing my ip in ssh port and any in http and https in inbound rule for keeping the ec2 more secure.
Now connect to your ec2 instance via ssh or via serial console. now let’s start the process .
Now add your ec2 ip to DNS record of your registered domain in registar in my case namecheap. Wait for sometime as it requires time to propagate the DNS to ec2. Meanwhile we setup the static website we write Dockerfile which exposes on port 5173 in my case since I am using threejs to host my website so here’s the dockerfile and yaml file for this
and here’s my docker-compose file
run docker compose up
now let’s configure nginx we create new file in /etc/nginx/sites-available make a conf file as your-servername.conf in my case rijalnitesh.com.conf
Now run the following commands
Now run the command to install ssl certificate
If everything goes well we are able to get site as mine
Thank you for reading my blog. I am always open to comments.
0 likes · 11 views · Jul 28, 2025
Guided hosting a portfolio website on EC2 for $2/month.
Timeline
Jun 29, 2023 - Jun 30, 2023