Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Mon Sep 26, 2011 2:31 pm 
Offline
Senior Newbie

Joined: Mon Sep 26, 2011 2:16 pm
Posts: 8
I have recently moved my VPS to linode and I am having an issue that has been bothering me for days. I only have a very basic knowledge of this type of thing so I am not sure what else to try at this point.

The problem:
www.mydomain.com <--- goes to correct virtualhost
mydomain.com <--- goes to default virtualhost which is not correct

I have a fresh Debian 6 vps with very basic stuff on it right now( LAMP ), I am also using a sub domain *.mydomain.com which works perfectly fine.

My default virtualhost has not been modified at all and is the default, mydomain.com virtualhost file is created exactly as instructed in the tutorial http://library.linode.com/lamp-guides/debian-6-squeeze

I have done a lot of searching over the past few days that I have been trying to figure this out including reading every single topic I could find on this forum about it. I have attempted every single possible solution I could find to the best of my abilities with no success.

I even contacted my domain provider to have them verify my A records and other records to make sure I didn't mess anything up in the process and they assured me that everything is perfectly fine.

So the conclusion is that I am obviously missing something but I am just not sure what and I would appreciate any help on this.


Top
   
 Post subject:
PostPosted: Mon Sep 26, 2011 3:16 pm 
Offline
Senior Newbie

Joined: Thu May 07, 2009 6:13 am
Posts: 18
Could you paste your VirtualHost files and the output of `apachectl -S` please?

It sounds like you've provided "ServerName www.mydomain.com" and have no "ServerAlias mydomain.com" or vise versa.


Top
   
 Post subject:
PostPosted: Mon Sep 26, 2011 3:39 pm 
Offline
Senior Member
User avatar

Joined: Thu Jun 16, 2011 8:24 am
Posts: 412
Location: Cyberspace
Since I can't see your configuration, I can only guess, but it's possible that you have two separate vhosts configured. If you want www.domain.com to go to the same place as domain.com, they should be in the same vhost.

Apache allows you to put a "ServerAlias" in the vhost, putting subdomains and other domains in the ServerAlias will tell apache that any connections to these "aliases" go to the same place as the main domain that you want have the vhost for.

If that's not the issue, we need to have your vhost config files. Depending on what the actual issue is, we might need the main apache configuration file, though I doubt this will be the issue since apache already seems to be working.

_________________
Kris the Piki Geeker


Top
   
 Post subject:
PostPosted: Mon Sep 26, 2011 3:57 pm 
Offline
Senior Newbie

Joined: Mon Sep 26, 2011 2:16 pm
Posts: 8
As requested:
---------------

VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80 is a NameVirtualHost
default server mydomain.com (/etc/apache2/sites-enabled/000-default:1)
port 80 namevhost mydomain.com (/etc/apache2/sites-enabled/000-default:1)
port 80 namevhost mydomain.com (/etc/apache2/sites-enabled/mydomain.com:1)
Syntax OK



Code:
<VirtualHost *:80>
        ServerAdmin webmaster@mydomain.com
        ServerName mydomain.com
        ServerAlias www.mydomain.com
        DocumentRoot /srv/www/mydomain.com/public_html/
        ErrorLog /srv/www/mydomain.com/logs/error.log
        CustomLog /srv/www/mydomain.com/logs/access.log combined
        ErrorDocument 404 /missing.php
</VirtualHost>


Top
   
 Post subject:
PostPosted: Mon Sep 26, 2011 5:38 pm 
Offline
Senior Member

Joined: Tue Feb 01, 2011 5:14 pm
Posts: 53
Have you got the "alias" apache module loaded?


apache2ctl -t -D DUMP_MODULES


Top
   
 Post subject:
PostPosted: Mon Sep 26, 2011 5:51 pm 
Offline
Senior Newbie

Joined: Mon Sep 26, 2011 2:16 pm
Posts: 8
Loaded Modules:
core_module (static)
log_config_module (static)
logio_module (static)
mpm_prefork_module (static)
http_module (static)
so_module (static)
alias_module (shared)
auth_basic_module (shared)
authn_file_module (shared)
authz_default_module (shared)
authz_groupfile_module (shared)
authz_host_module (shared)
authz_user_module (shared)
autoindex_module (shared)
cgi_module (shared)
deflate_module (shared)
dir_module (shared)
env_module (shared)
mime_module (shared)
negotiation_module (shared)
php5_module (shared)
reqtimeout_module (shared)
rewrite_module (shared)
setenvif_module (shared)
status_module (shared)
Syntax OK


Top
   
 Post subject:
PostPosted: Mon Sep 26, 2011 9:54 pm 
Offline
Senior Member
User avatar

Joined: Sat Aug 30, 2008 1:55 pm
Posts: 1739
Location: Rochester, New York
Does the output of "hostname -f" say "mydomain.com"? If so, try changing your system hostname to something specific, like "bob.mydomain.com".


Top
   
 Post subject:
PostPosted: Mon Sep 26, 2011 10:22 pm 
Offline
Senior Newbie

Joined: Mon Sep 26, 2011 2:16 pm
Posts: 8
full qualified domain name is not the same and just to be sure I changed it to something else and still no luck.


Top
   
 Post subject:
PostPosted: Tue Sep 27, 2011 12:59 am 
Offline
Senior Newbie

Joined: Mon Mar 21, 2011 2:04 am
Posts: 9
Website: http://www.voidfaction.com
Location: Noblesville, IN
Do you have (domain.com) and (www.domain.com) in your DNS A/AAAA record?

linode DNS manager a/aaaa record should have one blank hostname entry and another for www Other than that the ServerAlias Should work with default install of apache on debian squeeze. copy both and replace ip address with ipv6 if you use that also.


Top
   
 Post subject:
PostPosted: Tue Sep 27, 2011 4:13 am 
Offline
Senior Newbie

Joined: Thu May 07, 2009 6:13 am
Posts: 18
evilyummycandy, your problem would be because of the default vhost that you have has the same ServerName/ServerAlias values, which is going to cause problems. Please paste the file "/etc/apache2/sites-available/default" to confirm this.

What Apache is currently doing is using the config in "/etc/apache2/sites-available/default" to serve the domain "mydomain.com".

If you don't need this default vhost (which from the looks of it, you don't) then you can simply do the following:

Code:
a2dissite default && unlink /etc/apache2/sites-available/default


The default vhost is simply the one that Apache comes across first in it's configuration, you don't need one called "default". This is just a Debian convention.


Top
   
 Post subject:
PostPosted: Tue Sep 27, 2011 11:45 pm 
Offline
Senior Newbie

Joined: Mon Sep 26, 2011 2:16 pm
Posts: 8
I just got back from work and I checked the www and without www and it works o_O.

I have done nothing else since my last attempt and now I am scared to mess with it because I will probably break it, for now I think it is best to leave it as is while it is working because I still have a ton of other things that I need to do to this VPS to get it up and running.

Even thought I have no idea what was done that magically fixed it( yes it is magic ) I would still like to say thanks to everyone who assisted me.

@AlecC: I did not edit my default and it is still up and running.


Top
   
 Post subject:
PostPosted: Wed Sep 28, 2011 12:09 am 
Offline
Senior Member
User avatar

Joined: Thu Jun 16, 2011 8:24 am
Posts: 412
Location: Cyberspace
Possibly a delay in your ISPs DNS. Just because your DNS records are updated doesn't mean everybody else's will be. Since you switched from another hosting company (and thus your server IP changed), it will take time for ISPs around the world to update their DNS to the new server. Different ISPs update at different intervals -- some update more frequently than others. Normally it takes up to 24 hours for everybody's DNS records to update, though doing a google search a few minutes ago, I saw a couple reports of it taking a maximum 72 hours, though it seems rare that would would actually take that long.

(edited to correct myself)

_________________
Kris the Piki Geeker


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