Problem with virtual host

Problem with virtual host

am 27.06.2007 23:02:24 von Bolos

Hi,
I have a problem with Apache running with windows XP. I have added a few
name based virtual host in the Apache configuration file and I have set
up the host file as usual.
The problem is that the virtual hosts work only if I'm connected to
internet, otherwise the browser tries to solve the host name (for
example "test") in test.com. This is the first time I have a problem
like this with virtual server.
Can anybody help me?

Thanks in advance.
-Bolos

Re: Problem with virtual host

am 28.06.2007 00:43:32 von shimmyshack

On Jun 27, 10:02 pm, Bolos wrote:
> Hi,
> I have a problem with Apache running with windows XP. I have added a few
> name based virtual host in the Apache configuration file and I have set
> up the host file as usual.
> The problem is that the virtual hosts work only if I'm connected to
> internet, otherwise the browser tries to solve the host name (for
> example "test") in test.com. This is the first time I have a problem
> like this with virtual server.
> Can anybody help me?
>
> Thanks in advance.
> -Bolos

you need to add the server names to the hosts file for all local
machines that need to get access to the server. It sounds like you
have only one, so just goto
c:\windows\system32\drivers\etc
open the file called
hosts
and add
127.0.0.1 vhost1.com
127.0.0.1 vhost2.com
127.0.0.1 test
127.0.0.1 anotherserver.com
and so on for each vhost section you have, for each servername you
need apache to answer to.

This is altering the local "DNS" so that you dont need access to a
public DNS server out on the internet.

Re: Problem with virtual host

am 28.06.2007 11:38:42 von Bolos

On 28 Giu, 00:43, shimmyshack wrote:
> you need to add the server names to the hosts file for all local
> machines that need to get access to the server. It sounds like you
> have only one, so just goto

I have already all my server names on my hosts file, but don't works.

-Bolos

Re: Problem with virtual host

am 28.06.2007 12:13:17 von shimmyshack

On Jun 28, 10:38 am, Bolos wrote:
> On 28 Giu, 00:43, shimmyshack wrote:
>
> > you need to add the server names to the hosts file for all local
> > machines that need to get access to the server. It sounds like you
> > have only one, so just goto
>
> I have already all my server names on my hosts file, but don't works.
>
> -Bolos

typing, try posting more details, without being more up front about
your setup, I am reluctant to keep guessing, setting up apache on XO
is not hard.
Is Ap. running as a service?
what IP did you use in the hosts file
what IP is Ap. listening on
if you are using a USB modem, has the driver set hacked your XP box
(some ISPs modem drivers completely screw with the inbuilt DNS
handling of XP)
can you get to AP. using
telnet localhost 80
or
telnet 127.0.0.1 80

if you get a blank screen type
GET / HTTP/1.1
and press return twice, what status code do you get.

When you say "the virtual hosts only work" what does that mean, does
other Apache stuff work.
Post more about your vhost setup and your problem can be easily solved

Re: Problem with virtual host

am 28.06.2007 14:39:47 von Bolos

On 28 Giu, 12:13, shimmyshack wrote:
> Is Ap. running as a service?
no
> what IP did you use in the hosts file
127.0.0.1
> what IP is Ap. listening on
127.0.0.1
> if you are using a USB modem, has the driver set hacked your XP box
> (some ISPs modem drivers completely screw with the inbuilt DNS
> handling of XP)
i have a lan
> can you get to AP. using
> telnet localhost 80
> or
> telnet 127.0.0.1 80
yes
> if you get a blank screen type
> GET / HTTP/1.1
> and press return twice, what status code do you get.
i can't write in telnet after the connection

> Post more about your vhost setup and your problem can be easily solved
this is a snippet of my apache config.

NameVirtualHost 127.0.0.1:80


DocumentRoot "C:/www/Alchelab"
ServerName alchelab


...and this from my host file
127.0.0.1 alchelab
127.0.0.1 localhost
etc.

Re: Problem with virtual host

am 28.06.2007 17:50:56 von shimmyshack

On Jun 28, 1:39 pm, Bolos wrote:
> On 28 Giu, 12:13, shimmyshack wrote:
>
> > Is Ap. running as a service?
> no
> > what IP did you use in the hosts file
> 127.0.0.1
> > what IP is Ap. listening on
> 127.0.0.1
> > if you are using a USB modem, has the driver set hacked your XP box
> > (some ISPs modem drivers completely screw with the inbuilt DNS
> > handling of XP)
> i have a lan
> > can you get to AP. using
> > telnet localhost 80
> > or
> > telnet 127.0.0.1 80
> yes
> > if you get a blank screen type
> > GET / HTTP/1.1
> > and press return twice, what status code do you get.
>
> i can't write in telnet after the connection
>
> > Post more about your vhost setup and your problem can be easily solved
>
> this is a snippet of my apache config.
>
> NameVirtualHost 127.0.0.1:80
>
>
> DocumentRoot "C:/www/Alchelab"
> ServerName alchelab
>

>
> ..and this from my host file
> 127.0.0.1 alchelab
> 127.0.0.1 localhost
> etc.


when you did
telnet 127.0.0.1 80
did the screen go black? If so success - you are connected to apache,
now what does it say?

this is from my last post:
"if you get a blank screen type
GET / HTTP/1.1
and press return twice, what status code do you get."

do that and post back the answer, and while youre at it, all the
headers and we can move slightly more forward.


As to your vhost setup:
what IP does apache Listen on (in the main httpd.conf)
It should be (if you are using an up2date version of Ap.)
Listen *:80
or just Listen *
I would have this instead:

NameVirtualHost *:80


DocumentRoot "C:/www/Alchelab"
ServerName alchelab


so that the vhost will answer on all IPs apache is listening on.

Re: Problem with virtual host

am 29.06.2007 00:25:54 von Bolos

shimmyshack ha scritto:
> Listen *:80
> NameVirtualHost *:80
>
>
> DocumentRoot "C:/www/Alchelab"
> ServerName alchelab
>



Hi,
I have tried to set up with this configuration and yes, all is working
fine now.

Thank you very much!
-Bolos