Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dns record pointing to a folder on a server

Tags:

subdomain

dns

can't figure it out if it is possible to set up DNS record to a folder on a server. Say sub.example.com to point on 1.2.3.4/e2/

Is it possible somehow to point domains directly to folders on a server so I can have different domains hosted on one server within different folders?

like image 322
o3inc Avatar asked Dec 19 '11 20:12

o3inc


People also ask

Can a Cname point to a directory?

No. CNAME records can only point to DNS records.

How do I point a domain to a folder?

Click on "Hosting" on the left side of the page under "My Products," then click on "Manage Account" and choose "Domain Management" under "Settings." Click "Add Domain." Enter the new domain name in the field marked "Domain," and enter the sub-folder that will contain the site in the "Folder" field.

What are 3 types of DNS records?

3 types of DNS queries—recursive, iterative, and non-recursive.


2 Answers

It is possible to host multiple domains on one server. It is called Virtual Hosting.

But you are confusing a few concepts. DNS is for converting names to ip addresses. The DNS system knows nothing about the folder structure. That is the responsibility of the webserver. You will configure Virtual Hosts on the web server.

The way this is normally done is to

  1. Add host record (aka, A record) in DNS. For example, coolname.domain.com -> 12.34.56.78.

  2. Configure webserver to read content for coolname.domain.com from folder of your choice.

like image 107
Pablo Maurin Avatar answered Oct 04 '22 22:10

Pablo Maurin


This is generally done with virtual hosting on your web server. DNS is not meant for that.

The closest you could do is use TXT records, but then no one other than you would be aware of that, so your clients wouldn't even know.

like image 31
fge Avatar answered Oct 04 '22 22:10

fge