1

My CNAME setting is enter image description here

I expect ms.fbny.org to be an alias of music-school.fbny.org. However when I go to ms.fbny.org, it actually goes to music-school.fbny.org's IP instead of music-school.fbny.org itself. So it is opening another website hosted on the same IP. Is this a normal behavior?

1
4

Yes, this is the default behavior. The web server should be configured to serve from the correct document root when the request comes from a specific subdomain.

For example, if you use apache, you should configure virtual hosts appropriately.

Ref: https://httpd.apache.org/docs/2.4/vhosts/examples.html

Above page contains the below example:

# Ensure that Apache listens on port 80
Listen 80
<VirtualHost *:80>
    DocumentRoot "/www/example1"
    ServerName www.example.com

    # Other directives here
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "/www/example2"
    ServerName www.example.org

    # Other directives here
</VirtualHost>

Request from www.example.org will be served from the folder /www/example2 and those from www.example.com will be served from /www/example1. Moreover, apache considers the first entry to be the default when there is no match for a server name.

(In case you use apache) your new subdomain (for which you had created a CNAME) may not be having a matching entry and hence default document root of the main domain is being used.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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