Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have created subdomains for my main site.

like

  • cdn1.abc.com
  • cdn2.abc.com
  • cdn3.abc.com

and all point to / . but when I try to use cdn1.abc.com in a url it does not work. Perchance there is something else I need to do?

share|improve this question

migrated from stackoverflow.com Jul 1 '10 at 3:22

This question came from our site for professional and enthusiast programmers.

    
What are you using to manage your subdomains? –  William Jun 30 '10 at 17:16
3  
and which web server? –  Eric Petroelje Jun 30 '10 at 17:18
    
@Eric Petroelje - apache server and godaddy account –  pradeep Jun 30 '10 at 17:23

3 Answers 3

With your virtual host settings, you need to add a ServerAlias, sort of like this:

<VirtualHost *:80>
        ServerName abc.com
        ServerAlias cdn1.abc.com cdn2.abc.com cdn3.abc.com

You could also do "*.abc.com" on that line instead, if you wanted to allow all subdomains.

share|improve this answer

You need to setup Apache to serve your files for all of the subdomains.

share|improve this answer
    
@SLaks - it says Server not found error –  pradeep Jun 30 '10 at 17:30
    
@SLaks - godaddy provides a interface to create subdomains. then also i need to do apache configuration.. can u just show me the apache code for it? –  pradeep Jun 30 '10 at 17:31

There are two parts to this:

  • You must create the DNS records so that those new names resolve to the IP address of your server. That will allow people to get sent to the correct location.
  • The second part is configuring Apache to recognize these new hostnames and serve the right content.

The first part will probably involve you using some online control-panel at your domain registrar. The second part will probably be as simple as adding:

 ...
 ServerName abc.com
 ServerAlias     cdn1.abc.com cdn2.abc.com cdn3.abc.com

then restarting apache2.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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