Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Tue Sep 25, 2012 2:15 pm 
Offline

Joined: Tue Sep 25, 2012 1:53 pm
Posts: 1
hi,

I have a basic question about whether my apache config is setup correctly on one of my linodes. We have a domain that is currently hosted on mediatemple but we are forwarding subdomains from that domain to linode.

So our mediatemple DNS config is like this:

A records for:

Code:
books.example.com -> [IP OF MY LINODE]
events.example.com -> [IP OF MY LINODE]

Then on the linode I don't have specific DNS entries just the following apache configs:


Code:
# /usr/sbin/apache2ctl -S
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80                   is a NameVirtualHost
         default server books.example.com (/etc/apache2/sites-enabled/books.example.com:1)
         port 80 namevhost books.example.com (/etc/apache2/sites-enabled/books.example.com:1)
         port 80 namevhost events.example.com (/etc/apache2/sites-enabled/events.example.com:1)

[ snip ... ]

Syntax OK


and my configs that are symlinked in sites-enabled:
Code:
# cat books.example.com 
<VirtualHost *:80>
        ServerAdmin admin@example.com
        ServerName books.example.com
        ServerAlias books.example.com
        DocumentRoot /srv/www/books.example.com/public_html/
        ErrorLog /srv/www/books.example.com/logs/error.log
        CustomLog /srv/www/books.example.com/logs/access.log combined

        <Directory />
                Options FollowSymLinks
                AllowOverride All
        </Directory>

</VirtualHost>

# cat events.example.com
<VirtualHost *:80>
        ServerAdmin admin@example.com
        ServerName events.example.com
        ServerAlias events.example.com
        DocumentRoot /srv/www/eventssite/public_html/
        ErrorLog /srv/www/eventssite/logs/error.log
        CustomLog /srv/www/eventssite/logs/access.log combined

        <Directory />
                Options FollowSymLinks
                AllowOverride All
        </Directory>

</VirtualHost>


Now the issue is that books.example.com returns the site at events.example.com and thing generally are a little glitchy. We set up the DNS for this about 18 hours ago. Is it just DNS propagation or is my configuration incorrect?

Please advise, I don't really know that much about DNS configurations... DO I need to modify my /etc/hosts file for example?

Thanks!
- J


Top
   
PostPosted: Tue Sep 25, 2012 5:19 pm 
Offline
Junior Member
User avatar

Joined: Mon Sep 17, 2012 4:33 am
Posts: 43
Website: http://www.bonsoni.com
A n00b here, but just wondering did you put both subs virtual host configs in the same file?

_________________
Ubuntu 10.4 LTS, Apache2, LAMP, n00b

Online Shopping


Top
   
PostPosted: Tue Sep 25, 2012 9:16 pm 
Offline
Senior Member
User avatar

Joined: Sun Jan 18, 2009 2:41 pm
Posts: 830
Not sure if this would actually cause any problems, but there's no point in having a ServerAlias directive with the same name you have as ServerName. I would remove the ServerAlias lines.

You can check DNS with dig +trace books.example.com - this will bypass your ISP's nameservers and do a lookup starting at the DNS root. Modifying your /etc/hosts only changes what your local machine sees, and probably won't be any help.


Top
   
PostPosted: Tue Sep 25, 2012 9:34 pm 
Offline
Senior Newbie

Joined: Thu Jan 19, 2012 10:12 am
Posts: 6
/etc/hosts can have an effect on apache virtual servers.
If your default virtual server is DocumentRoot /srv/www/books.example.com/public_html/, and events.example.com is in the hosts file to resolve to the IP address of the server, then apache fails to pick up on the fact that the request comes from events.example.com and instead assumes it was a request made directly to the IP address of the server, which causes it to use the default virtual site.
You may wish to remove events.example.com from /etc/hosts if it is in there, and see if this makes a difference. If nothing I have said makes sense, it may be useful to paste us the hosts file.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group