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 [email protected] 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