Setting up your personal website/blog

Few things you need to decide on:

  1. Do you need a CMS(content management system)? – If you want a blog, and do not want the hassle to build it ground up, go for a cms. options: blogger, wordpress, medium.
  2. Do you need a custom domain? – If you want a domain like “www.your-name.com” or not.
  3. Do you want blog as a part of your website, on a sub domain, but keep the main domain for custom stuff? – e.g. “blog.your-name.com” for the blog, and “www.your-name.com” for your cat’s photo.

I wanted all three, here’s what i did

Getting your domain.

Go to your favourite domain seller an register your domain, you can also select your domain from wordpress. I chose hostgator and the domain cost around 1000 Rs per year.

Setting up wordpress

Make an account and set up your blog/website. Custom domain is not available on wordpress’ free account so you would need to upgrade to at least the personal account level. This comes at a charge of 2400 Rs per year.

Once done, go to your site and select the option to add domain from sidebar.

Click on map my domain(or select a domain if you want to get the domain from wordpress itself) and point it to your domain/subdomain eg. “www.your-name.com” or “blog.your-name.com”

Add a CNAME record, mapping your custom domain/sub-domain to your wordpress site. This functionality should be available with your domain provider.

Now you have your blog set up at your favourite domain. You can go ahead and customize it and start your fancy blogging.

However, If you set your blog at a subdomain(blog.your-name.com) your main domain(www.your-name.com) will throw a 404 error or show a weird ad page(my domain provider did this).

One way to fix this would be to redirect all calls from your main domain to your sub domain(the one configured to show wordpress).

To do this you can make a small web application and deploy it on your main domain. I did this with a small node web app and deployed it on heroku.

Deploying your app on heroku

Create your node app. Create your account at heroku and download heroku-cli.

Login to heroku.

heroku login

And enter your account credentials.
Create your app in heroku by going to you git project repository and execute the command

heroku create
git push heroku master

You can try out your app by giving the command

heroku open

Your app is now deployed, but as you see its address is {something_something}.heroku.com To change it to your main domain, you’ll need to go to heroku account in the browser and then to your app dashboard. In the settings, you can find the domain controls, where you can add your domain.

This can also be done via cli by command:

heroku domains:add your-domain.com

Either way, heroku might prompt you to verify your account by adding a credit card. They do this for verification, and no credits are made for adding a domain.

As a final step, you would need to add a cname record mapping your custom heroku domain to the dns target provided by heroku when you create your domain. You can check that in your app dashboard domain settings or through cli command

heroku domains

That is it. When you now hit your main domain you’ll see whatever your app is supposed to show you.