I am using apache + nginx (for serving static content) and just bought a CDN. I have added a CNAME entry to my CDN URL, which should be cdn.example.com and pointing to the original cdn url. xxx.netdna-cdn.com/

But probably because of my nginx vhost file when I run cdn.example.com, it opens the first server entry site in my vhost file.

I have multiple sites in my server. I have added CNAME from CPanel DNS editor as well.

No luck, so I think I need to add something in the vhost.conf.

  • 2
    CNAMEs do not configure your web server for you. You need to setup a vhost for the cdn.example.com address. – gparent May 6 '12 at 21:38

No chances are your DNS is still cached so it is still hitting your webserver and not the CDN's server. Make sure your dns is resolving correctly on your computer

 nslookup cdn.domain.com

If it is make sure you have no hosts entry hardcoding the cdn host to an IP since your browser will use that before asking DNS for the IP.

  • nop not added anything in vhost for the cdn.domain.com .. – Ayaz Malik Apr 30 '12 at 20:14

If you're planning to redirect cdn.example.com to your CDN url, you'll need to add a CNAME entry from your DNS control panel. Something to the effect of:

cdn    IN    CNAME  xxx.netdna-cdn.com

You don't need to configure any vhost at your end.

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.