0

I have a domain and subdomains on a server say example.com and api.example.com We want to add another server to our application cdn.example.com which is a different physical server. So i'm trying to configure subdomain cdn.example.com I've mapped the ip of new server to subdomain cdn.example.com

when i ping cdn.example.com its returning correct ip. But when i put this url in browsers its now showing page in the subdomain directory.

I've create virtual host in /etc/apache2/sites-enabled/cdn.example.com

when i try to open site using ip its showing the pages in default directory /var/www/index.html

i;ve mapped the cdn.example.com to folder /srv/www/cdn.example.com/public_html

<VirtualHost *:80>
     ServerAdmin webmaster@example.com
     ServerName cdn.example.com
     DocumentRoot /srv/www/cdn.example.com/public_html/
     ErrorLog /srv/www/cdn.example.com/logs/error.log
     CustomLog /srv/www/cdn.example.com/logs/access.log combined
</VirtualHost>

this is my cdn.example.com file in sites-enabled directory

I have two questions: 1. is it necessary to configure main domain before configuring subdomain? 2. can we configure only subdomain on server?

PS: I have debian 6.0.3 on my new server

0
  1. is it necessary to configure main domain before configuring subdomain?

No.

A useful point is that the first defined site is the one that is served if the client request is for a site domain name or address not in the Apache configuration explicitly.

  1. can we configure only subdomain on server?

Yes.

You'll need to arrange in DNS that the subdomain's address records point to the appropriate web-server.

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.