How to configure DNS for sub domain publishing

If you want to allow your end-users to publish their site(s) using sub domains, like abc.yourdomain.com, you will need to complete the following steps:

  1. Configure your Pagestead server’s local DNS to redirect all subdomains to the folder on your server containing your Pagestead application. This is achieved by setting up a local DNS wildcard record (an “A” type record with value “*”).
  2. Configure your main domain’s DNS to send all sub domain requests for the domain to your Pagestead server. This is achieved by adding a DNS wildcard entry to your main domain’s DNS records (another type “A” record with value “*”, this time pointing to your Pagestead server).

1. Local DNS on your Pagestead server

This first step takes place on your Pagestead server. The exact way to complete this depends on your server’s configuration and on the operating system running your server. Below, we go through the steps for the three most common scenarios.

a. Using cPanel hosting

If you are managing your Pagestead server using cPanel then its pretty easy, follow the following steps:

  1. Click the link labeled “Subdomains” in the “DOMAINS” section
  2. There you will get three fields: “Subdomain”, “Domain” and “Document Root”. In the Subdomain field put the value¬† “*”. In the Domain field, make sure your Pagestead domain is selected. Finally, make sure the Document Root field points to the folder location where your Pagestead application is located (hint: typically this would be “public_html”)

If you are using VPS or Dedicated server and don’t have cPanel running, then you need to manually add a ServerAlias in your apache virtual host file. Bellow we will describe the process for Debian based (Debian, Ubuntu etc.) Linux distributions and RedHat based (CentOS, RedHat etc.) Linux distributions:

b. Using a Debian based Linux distribution (Ubuntu)

  1. Edit your active virtual host file from /etc/apache2/sites-available/ and add the following line (be sure to replace yourdomain.ext with your actual Pagestead domain name!),
    ServerAlias *.yourdomain.extafter the following line:
    ServerName yourdomain.ext
  2. Restart your apache service with the following command,
    sudo service apache2 restart

c. Using a RedHat based Linux distribution (Mandrake, Fedora Core, CentOS)

  1. Edit your active virtual host file from /etc/httpd/sites-available/ and add the following line (be sure to replace yourdomain.ext with your actual Pagestead domain name!),
    ServerAlias *.yourdomain.extafter the following line:
    ServerName yourdomain.ext
  2. Restart your apache service with the following command,
    sudo service httpd restart

2. Main domain DNS records

Using cPanel

Login to your cPanel and Click over Zone Editor and Add an A Record with Name * and address as your Server IP.

Using your domain registrar’s DNS

Log into your account with your domain registrar (the organization from which you purchased the domain) and locate the DNS administration area. Create a new DNS “A” record, set its value to “*” and point the new record to the IP address of your Pagestead server. If you do not know what the IP address of your Pagestead server is, you can use a tool like this one to figure out the correct IP address.

Was this article helpful?

Related Articles

Leave A Comment?

You must be logged in to post a comment.