Linode Forum Index Linode Forum
Linode Community Forums
 


URL going to wrong site

Click here to go to the original topic

 
       Linode Forum Index -> Linux Networking
Author Message
crazyfruitbat



Joined: 12 Feb 2011
Posts: 55

Posted: Thu Feb 09, 2012 7:52 am    Post subject: URL going to wrong site  

Hi guys, I just added a new domain to my server but its jumping to another crap blog that I made a while back instead of it's own location on the server.

I've made a new vhost file in sites-available:
Code: <VirtualHost 178.79.183.119:81>
     # Postfix admin
     Alias /postfixadmin /srv/www/postfixadmin
     # blog
     ServerAdmin chris@pixelatedphotographer.com
     ServerName standingstart.net
     ServerAlias www.standingstart.net
     DocumentRoot /srv/www/standingstart.net/public_html/
     ErrorLog /srv/www/standingstart.net/logs/error.log
     CustomLog /srv/www/standingstart.net/logs/access.log combined
</VirtualHost>

The other domain is:
Code: <VirtualHost 178.79.183.119:80>
     # Postfix admin
     Alias /postfixadmin /srv/www/postfixadmin
     # blog
     ServerAdmin chris@pixelatedphotographer.com
     ServerName chrisgilloch.com
     ServerAlias www.chrisgilloch.com
     DocumentRoot /srv/www/chrisgilloch.com/public_html/
     ErrorLog /srv/www/chrisgilloch.com/logs/error.log
     CustomLog /srv/www/chrisgilloch.com/logs/access.log combined
</VirtualHost>

When I had them both at <VirtualHost 178.79.183.119:80> I got the error:
Code: [warn] VirtualHost 178.79.183.119:80 overlaps with VirtualHost 178.79.183.119:80, the first has precedence, perhaps you need a NameVirtualHost directive

and updated the hosts file:
127.0.0.1 localhost.localdomain localhost
178.79.183.119 swansea.chrisgilloch.com swansea
178.79.183.119 swansea.standingstart.net swansea

but www.standingstart.net jumps to www.chrisgilloch.com

My DNS settings are as follows:






I'm running Apache on ubuntu lucid

Can you guys spot where I'm going wrong? Any ideas would be great!

Cheers
Chris

[/code]
Back to top  
phyber



Joined: 15 Apr 2011
Posts: 8

Posted: Thu Feb 09, 2012 8:03 am    Post subject:  

Code: <VirtualHost 178.79.183.119:81>
standingstart.net is on port 81, not port 80.
You'd have to set up apache to listen on port 81 and access the site as http://standingstart.net:81/
Just going to http://standingstart.net/ is equivalent to http://standingstart.net:80/ and since there is no standingstart.net on port 80, you end up hitting the default VirtualHost, which in this case happens to be www.chrisgilloch.com.
You should look at this piece of apache documentation for more info on the error message and how you can fix all of this.
Back to top  
hybinet



Joined: 02 May 2008
Posts: 1058

Posted: Thu Feb 09, 2012 9:14 am    Post subject:  

You just need to add "NameVirtualHost *:80" somewhere in your Apache config. If you're on Ubuntu, this should be in your default configuration, but it seems that somehow it got lost.
Back to top  
NeonNero



Joined: 04 Jan 2005
Posts: 215
Location: Ålesund, Norway

Posted: Thu Feb 09, 2012 9:17 am    Post subject: Re: URL going to wrong site  

crazyfruitbat wrote: ...

When I had them both at <VirtualHost 178.79.183.119:80> I got the error:
Code: [warn] VirtualHost 178.79.183.119:80 overlaps with VirtualHost 178.79.183.119:80, the first has precedence, perhaps you need a NameVirtualHost directive
... This should possibly be a hint at what you may be missing, though. Somewhere in your configuration (not in one of the sites-available files), you need a line like this:
Code: NameVirtualHost 178.79.183.119:80
Back to top  
crazyfruitbat



Joined: 12 Feb 2011
Posts: 55

Posted: Thu Feb 09, 2012 9:23 am    Post subject:  

Hi Guys, many thanks for your answers you were all right.

I stuck:
NameVirtualHost 178.79.183.119:80

<VirtualHost 178.79.183.119:80>
ServerName www.chrisgilloch.com
ServerAlias chrisgilloch.com *.chrisgilloch.com
DocumentRoot /srv/www/chrisgilloch.com/public_html/
</VirtualHost>

<VirtualHost 178.79.183.119:80>
ServerName www.standingstart.net
DocumentRoot /srv/www/standingstart.net/public_html/
</VirtualHost>

Into the httpd.conf file and that resolved the issues.

Thank you for all the help!
Back to top  
 
       Linode Forum Index -> Linux Networking
Page 1 of 1