Hosting Multiple Domains/Subdomains on Single AWS EC2 Instance

Spent the last few days figuring out how to host multiple domains on single instance. Reading copious amount of AWS documentation, StackOverflow Q&A, and blogposts followed by lot of experimentation has resulted in me hosting two domain names with a subdomain on a single AWS EC2 instance. Sharing the steps involved so that it is easy for everyone else.

 

Prerequisite

 

Getting Hosted Zone Setup

1. Login to your AWS console and select Route 53 from the Services dropdown.

2. On the navigation panel, select Hosted zones.

3. Tap on the Create Hosted Zone. Enter the domain name. Select Public Hosted Zone in Type dropdown.
If you bought domain name from Route 53, then AWS will create a hosted zone for you. You can skip to step 6.

4. AWS will create 2 record sets – NS and SOA (DO NOT edit these).

5. Copy name server values from NS record and enter it against the domain name on the panel of your domain name registrar.

6. To create the main domain, click Create Record Set.

  • Leave the Name blank
  • Select A – IPv4 address in Type drop down
  • Enter Public IP address of your instance or load balancer in Value
  • Save Record Set.

7. To set subdomain, add another Record Set by tapping Create Record Set.

  • In the Name enter the subdomain
  • Select A – IPv4 address in Type drop down
  • Enter the IP address of your instance or load balancer in Value. Save Record Set

Repeat these steps for all the domains you want to host on the instance.

At this point your should have all your domain names and subdomains setup. While you wait for DNS across the world to update their records, setup the Apache server. …continue reading

Here we go again!

A couple of weeks ago I decided to revive this website. So installed WordPress, uploaded my old theme and … kaput! It rendered horribly; after all it was written more than 3 years ago. So, I took a quick detour to catch-up on WP codex. I was surprised (pleasantly) how much WP has improved – structure, standard, security, support – on all counts. Kudos to the WP team and community.

I threw out the old theme and wrote one from scratch. It is still work in progress, as most thing always are, but it is in good enough shape to be used for the blog. Updates to theme – with aim to keep it light, clean, and responsive – and new blogposts – with aim to entertain, share, and discuss – will happen. Hopefully more frequently than every 3 years. *fingers crossed*

Here is to new beginnings.