Linode Forum
https://forum.linode.com/

URL going to wrong site
https://forum.linode.com/viewtopic.php?f=19&t=8407
Page 1 of 1

Author:  crazyfruitbat [ Thu Feb 09, 2012 8: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:

Image

Image


I'm running Apache on ubuntu lucid

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

Cheers
Chris

[/code]

Author:  phyber [ Thu Feb 09, 2012 9: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.

Author:  hybinet [ Thu Feb 09, 2012 10: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.

Author:  NeonNero [ Thu Feb 09, 2012 10: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

Author:  crazyfruitbat [ Thu Feb 09, 2012 10: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!

Page 1 of 1 All times are UTC-04:00
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/