Subdomain is an easy and free way to categorize your website content and separate them from the main website. In this tutorial, you will learn what is a subdomain, the use cases, and how to host a web application at subdomain using RunCloud.

What is a Subdomain?

A subdomain is a domain that is a part of a root domain, separated by a dot (“.”). For example, sub.domain.com is a subdomain of the root domain yourdomain.com .
Subdomain is used as an easy way to create a memorable website address to organize your website content. For example, gallery.yoursite.com for the photo galleries of your website.
Uses of subdomain includes:

  • Organizing website content according to category, i.e: support.yoursite.com, download.yoursite.com, shop.yoursite.com
  • Serve sub website for other users, i.e: jeff.yoursite.com, admin.yoursite.com, user1.yoursite.com
  • Make long link easy to remember. For example, shorten the long link https://yoursite.com/special/content/you-cannot-remember-this/123121513/ to a subdomain special.yoursite.com
  • Create a copy of your main website for testing. You can clone your main website into subdomain for testing and development, i.e: beta.yoursite.com
  • Mobile website: m.yoursite.com
  • Location specified website: malaysia.yoursite.com

Create a subdomain for RunCloud Web Application

It is easy to use a subdomain for your web application using RunCloud panel.
Firstly, you will create a web application as usual but at the “Domain Name” field, you enter the subdomain instead of the root domain. Choose the PHP version and server stack, then click “Add Web Application” button to create the web application at subdomain.
Now you need to add a DNS record for the subdomain to your domain name’s DNS zone.
In this article, I use CloudFlare DNS for example. If you are not sure how to do it, please refer to your DNS hosting provider (usually also your domain registrar) for support.
Here are the steps to add a subdomain DNS record for your RunCloud web application:

  1. Get your server IP address. You can view and copy the server IP address at the RunCloud servers overview or server summary page. Simply click on the IP address (numeric string) below server name to copy it. Write down the IP address because we will need it later.
  2. Login your DNS hosting control panel to add a new DNS record into your domain name’s DNS zone.
  3. Add a new “A” type DNS record, with the subdomain name and point to the server IP address. For example, sub is the subdomain and 0.0.0.0 is the server IP address (refer screenshot below)

Now you can visit sub.yoursite.com and RunCloud will serve your web application at the subdomain as usual.