My bro is using a service of a third party(say, X), with DNS addresses:


So, bro bought a domain name, say abc.com. And pointed the DNS addresses with the above ones.

Now, bro wants to create a subdomain, say mysite.abc.com with custom content. But this service provider X, doesn't offer hosting of files that we give to them for the subdomain. Instead, they said they have created a subdomain and is pointing to my server(say, with an IP:

So, how do I add a subdomain for mysite.abc.com in my server? BTW, I'm having a VPS server, with root access.

So far, I can see that adding a subdomain is possible only if the main domain is added. What changes do I have to make in my server so that, when accessing mysite.abc.com, files from my server would be delivered?

Sorry, I am not sure whether I confused you. Let me know if you need me to rephrase the issue or explain it with visual examples or something.

Thank you

  • As suspected, the question is a little confusing. Who is your DNS provider? What web server are you using (Apache, IIS, etc...)? Are you using a control panel, and if not, are you familiar with editing web server configuration files?
    – dan
    Commented Jul 3, 2013 at 22:39
  • Sorry for the delay. Was having some headache over certain things. I got it working now. cPanel was preventing me from adding an addon domain which has the DNS server names put to the third party's server. I will post the details as an answer in detail. Commented Jul 14, 2013 at 16:47

1 Answer 1


For a VPS with root access, follow this guide to add a subdomain:


Here's a quick example for you.

<virtualhost *:80>
  ServerName mysite.abc.com
  DocumentRoot /path/to/the/site/files/of/mysite.abc.com
  ServerAdmin [email protected]
  ErrorLog "/logs/mysite.abc.com.error.log"
  CustomLog "/logs/mysite.abc.com.access.log" common

Good luck!

  • Thank you. But I got it resolved. Will post the solution as an answer. Commented Jul 14, 2013 at 16:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.