3fceff8f3c15ea3fd96d449e3610fb7d2f4f88b5
By:
rami1

How do i map a subdomain (Wordpress/Ubuntu) to it's own registered domain

March 14, 2015 4.1k views
DNS WordPress Ubuntu

Hi, installed wordpress using the 1 click set up on Ubuntu 14.04. I created my main wordpress site, then i enabled multisite and created a second subdomain site.

I assigned my ip address to my first site and pointed it's registered domain to the digital oceans name server.

How do i map the subdomain site to another registered domain, so instead of the address being "subdomain.domain.com" it has it's own unique address even though they both have the same ip address.

2 Answers

You need to create DNS A records for each subdomain you wish to use and point them to the IP address of your server. Alternatively, you can create a single "wildcard" entry. Check out this tutorial for more information on setting up WordPress Multisite. It doesn't use the One-Click app as a base, but it should point you in the right direction.

by Jesin A
This tutorial will show you how to set up WordPress Multisite with subdomains on an Nginx web server. This allows you to run multiple unrelated websites, with their own domains, from a single WordPress admin panel.
  • Thanks for the reply, do i create multiple A records for each subdomain under the same domain, or do i create a new domain for each site and create an A record for each them ?

    if the first then what about cname?

  • @rami1, one A record for each subdomain under the same domain.

    This tutorial explains the different DNS records well:

    A Records: Use this space to enter in the IP address of the droplet that you want to host your domain name on and the host name itself, a name prepended to your domain name.

    CNAME Records: The CNAME record works as an alias of the A Record, pointing a subdomain to an A record— if an A Record’s IP address changes, the CNAME will follow to the new address.

    Basically, an A record points to an IP address, while a CNAME record points to another record.

    In your case, you can either create an A record pointing to your droplet's IP address for each subdomain, or create an A record for the droplet itself (e.g. droplet1.yourdomain.com) and then create a CNAME record for each domain pointing to the "droplet1" A record.

    Either way works fine.

    by Etel Sverdlov
    This article walks you through setting up the DNS for your site. The tutorial includes steps to set up an A records, point your nameservers, and provides some information about MX records.
[deleted]
  • @kamaln7 , Thanks for your help. Ive since tried to set up multiple sites using the following tutorials:

    • How To Set Up Apache Virtual Hosts on Ubuntu 14.04 LTS
    • How To Install Wordpress on Ubuntu 14.04

    Everything seems to be set up correctly i have the 1st WP site working, but i can't get the second to work at the moment.

    Is this the same answer when setting multiple VPS, i.e. one A record for each website under the same domain.

    I'm trying to pinpoint the issue, the second website says "Error establishing a database connection"

Have another answer? Share your knowledge.