Twitter

How To Host A Subdomain On A Different Server To Your Main Website

Now that I develop a lot of projects in Ruby on Rails, they require specialist hosting. The standard shared hosting accounts that host so many websites including those powered by WordPress just don’t provide enough server resources to run a modern and complex web application.

But what if I want to also run a WordPress powered blog as a section of the same domain? This sounds complicated.

It is actually possible to run different subdomains (something.example.com) on different servers.

How?

Create a new A record in the DNS for the domain in question. You can usually do this through your registrar.

You’ll need 2 things in order to do this:

  1. The name of the subdomain you want to create
  2. The IP address of the server you want to point it at.

Creating an A record is then fairly straight forward.

Where it says HOST, type the name of the subdomain. So for example if you’re trying to create blog.example.com, the host would just be “blog”.

Where it says points to, or IP, type the IP address of the server where you’re going to host the subdomain.

Now, you can head over to your hosting account and Add Domain or Addon Domain as is standard practise in CPanel.

For domain to add, type the full name: blog.example.com.

If your domain registrar is GoDaddy, everything should work within about 30 seconds. But for other registrars it can take up to 24 hours.

Copyright 2021. All Rights Reserved. Adam Patel