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:

 <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:

 <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 I got the error:

[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:

~~![](<URL url=)http://www.pixelatedphotographer.com/chris/stand.png" />

~~![](<URL url=)http://www.pixelatedphotographer.com/chris/chris.png" />

I'm running Apache on ubuntu lucid

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

Cheers

Chris~~~~

4 Replies

<virtualhost 178.79.183.119:81=""></virtualhost>
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.

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.

@crazyfruitbat:

When I had them both at I got the error:

[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:

NameVirtualHost 178.79.183.119:80

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

I stuck:

NameVirtualHost 178.79.183.119:80

ServerName www.chrisgilloch.com

ServerAlias chrisgilloch.com *.chrisgilloch.com

DocumentRoot /srv/www/chrisgilloch.com/public_html/

ServerName www.standingstart.net

DocumentRoot /srv/www/standingstart.net/public_html/

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

Thank you for all the help!

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct