Macchiato
Macchiato

Reputation: 815

DNS Configuration for domains and subdomains to point to single IP

I have domain my-domain.com, I want to setup (DNS) sub domains to point to my 'PUBLIC IP' where my website is hosted

Currently I have this, setup in DNS:

--------------------------------------------------------------
|        Domain          |    Type    |       Content        |
==============================================================    
|   www.my-domain.com    |     A      |    'PUBLIC IP'       |
--------------------------------------------------------------

and in my website host box, I setup one nginx server block point to my main website 'www.my-domain.com'

server {
    listen 80;
    server_name www.my-domain.com

    location / {
        proxy_pass http://127.0.0.1:8080
    }
 }

Now I want to run another website in the same box and i want it to be accessible using blogs.my-domain.com. With this, I'm going to setup another nginx server block as :

server {
    listen 80;
    server_name blogs.my-domain.com

    location / {
        proxy_pass http://127.0.0.1:8081
    }
 }

How do i configure blogs.my-domain.com DNS Entry?

Thanks in advance for the help.

Upvotes: 0

Views: 992

Answers (1)

Wil Tan
Wil Tan

Reputation: 711

You can create it as a CNAME record:

blogs.my-domain.com  CNAME  www.my-domain.com

Note that with some DNS software the above won't work because it is using relative domains, i.e. they don't terminate in a ..

Upvotes: 1

Related Questions