DNS Configuration for domains and subdomains to point to single IP

假装没事ソ 提交于 2019-12-12 04:01:47

问题


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.


回答1:


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 ..



来源:https://stackoverflow.com/questions/18245213/dns-configuration-for-domains-and-subdomains-to-point-to-single-ip

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!