Jump to content

Hey All - need help with Virtual Host


Cascade

Recommended Posts

Hey everyone , me and drace are having some problems getting our virtual host to work properly , here is the code we have
[code]<VirtualHost *>
  ServerName www.paranoiaonline.co.uk
  ServerAlias paranoiaonline.co.uk
  DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/pwd/"
</VirtualHost>
#
<VirtualHost *>
  ServerName www.cascade-online.com
  ServerAlias cascade-online.com
  DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/cascade"
</VirtualHost>

<VirtualHost *>
  ServerName www.gamingsearch.co.uk
  ServerAlias gamingsearch.co.uk
  DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/cheats"
</VirtualHost>
[/code]

www.paranoiaonline.co.uk works fine , it goes to the correct page , but as soon as we try www.cascade-online.com it doesnt work but we have found if we put www.cascade-online.com/cascade it does work , we dont know why
we think there is an error somewhere in our code can someone please clarify it for us
Link to comment
Share on other sites

Could it simply be that you are missing a trailing slash /

DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/cascade"

should be:

DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/cascade/"

-steve
Link to comment
Share on other sites

Added the slashes, but it didn't make any difference other, it still needed the "/cascade" on the end to go to the correct site, although one thing Cascade missed out was that, the document root in the httpd file is set to:

DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/pwd/"

should this be changed to any thing in particular?
Link to comment
Share on other sites

Okay... Sorry havent been around. See you got one working...

Did you forget to add this...

[code]# For Name Based Virtual Hosts
NameVirtualHost *[/code]

Before your vhost section like I told you in the other [url=http://www.phpfreaks.com/forums/index.php/topic,121040.msg498323.html#msg498323]forum post[/url]?

Second you do not need the trailing slash... I gave you an example of what your vhost section should look like...
Link to comment
Share on other sites

Oops I meant this [url=http://www.phpfreaks.com/forums/index.php/topic,121040.msg498351.html#msg498351]Forum post[/url]!

It should look like this...
[code]#
#
# $---> Section 1: HTTP Virtual Host Configuration <---$
#
#
# For Name Based Virtual Hosts
NameVirtualHost *
#
<VirtualHost *>
  ServerName www.paranoiaonline.co.uk
  ServerAlias paranoiaonline.co.uk
  DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/pwd"
</VirtualHost>
#
<VirtualHost *>
  ServerName www.cascade-online.com
  ServerAlias cascade-online.com
  DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/cascade"
</VirtualHost>

<VirtualHost *>
  ServerName www.gamingsearch.co.uk
  ServerAlias gamingsearch.co.uk
  DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/cheats"
</VirtualHost>[/code]
Link to comment
Share on other sites

We changed the VH as we were missing the code at the top, however after putting the updated VH and restarting apache we still have the same problem, they all load the paranoiaonline.co.uk site, this is really annoying me at the moment, any suggestions?? Also, could this be because of the DocumentRoot in the httpd file being set too:

DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/pwd"

Although, I've changed this to each of the web site directories e.g. pwd to  cascade etc, and they all seem to be served with the paranoiaonline.co.uk web site, this is seriously messing me about at the mo, so any help is greatly appreciated folks

Drace
Link to comment
Share on other sites

I am having the exact same sympoms.  Been beating my head against the wall for the past 4 hours, even started the httpd.conf from scratch, gone through replacing everythign with ips, tried making bogus virtual hosts or even additional strange ones.  It doesn't matter what I do, everything always gets "caught" from the first one.  Getting sick of re-reading the documentation over and over again.  Sorry for sounding dismal, just putting in my few thoughts.

Will be watching this thread very closely ^_^;;
Link to comment
Share on other sites

Oh, the first one is working though, it follows the document root properly, and differs from the default one specified in the httpd.conf, when I had it there.  Also tried specifying ports to get around the mod_ssl problem which shouldn't impact me for NameVirtualHost. (damn, cant edit after a couple mins of posting  :( )
Link to comment
Share on other sites

Just a few ideas:

Should the slashes be the other way? ->
C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\cheats\

Is your httpd.conf in dos format text? Edit it via notepad only.

Is there any error logs?

Its as if your VirtualHosts are NOT been registered. Is apache setup correctly to use VirtualHosts??

Remove your VirtualHosts altogether - and I bet you will still get the same page.

I dont know will this change things but, my config is like this:
Listen 80
#ommited usual configs

ServerName HostingServer.com

NameVirtualHost *:80
<VirtualHost *:80>
  ServerName www.paranoiaonline.co.uk
  ServerAlias paranoiaonline.co.uk
  DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/pwd/"
</VirtualHost>

<VirtualHost *:80>
  ServerName www.gamingsearch.co.uk
  ServerAlias gamingsearch.co.uk
  DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/cheats/"
</VirtualHost>

-steve
Link to comment
Share on other sites

Off hand it should just work.
Apache2.2 has other command line commands apart from starting and stoping apache.

apache2 -L 
apache2 -l
apache2 -V
apache2 -t -D DUMP_VHOSTS
apache2 -S

apache2 -t 
the above will check all your apache2 syntax.

Now you may have to run the above commands via apachectl if you dont have apache2.exe etc.

Lastly - perhaps just go with apache2 instead of apache2.2 Anyways - keep googling.

-steve
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.