|
Home > Archive > Apache Server configuration support > June 2007 > Problem with virtual host
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Problem with virtual host
|
|
|
| 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
| |
| shimmyshack 2007-06-27, 7:20 pm |
| On Jun 27, 10:02 pm, Bolos <nos...@tnx.com> 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.
| |
|
| On 28 Giu, 00:43, shimmyshack <matt.fa...@gmail.com> 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
| |
| shimmyshack 2007-06-28, 7:32 am |
| On Jun 28, 10:38 am, Bolos <granze...@gmail.com> wrote:
> On 28 Giu, 00:43, shimmyshack <matt.fa...@gmail.com> wrote:
>
>
> 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
| |
|
| On 28 Giu, 12:13, shimmyshack <matt.fa...@gmail.com> 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
<VirtualHost 127.0.0.1:80>
DocumentRoot "C:/www/Alchelab"
ServerName alchelab
</VirtualHost>
...and this from my host file
127.0.0.1 alchelab
127.0.0.1 localhost
etc.
| |
| shimmyshack 2007-06-28, 1:29 pm |
| On Jun 28, 1:39 pm, Bolos <granze...@gmail.com> wrote:
> On 28 Giu, 12:13, shimmyshack <matt.fa...@gmail.com> wrote:
>
> no
> 127.0.0.1
> 127.0.0.1
> i have a lan
> yes
>
> i can't write in telnet after the connection
>
>
> this is a snippet of my apache config.
>
> NameVirtualHost 127.0.0.1:80
>
> <VirtualHost 127.0.0.1:80>
> DocumentRoot "C:/www/Alchelab"
> ServerName alchelab
> </VirtualHost>
>
> ..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
<VirtualHost *:80>
DocumentRoot "C:/www/Alchelab"
ServerName alchelab
</VirtualHost>
so that the vhost will answer on all IPs apache is listening on.
| |
|
| shimmyshack ha scritto:
> Listen *:80
> NameVirtualHost *:80
>
> <VirtualHost *:80>
> DocumentRoot "C:/www/Alchelab"
> ServerName alchelab
> </VirtualHost>
Hi,
I have tried to set up with this configuration and yes, all is working
fine now.
Thank you very much!
-Bolos
|
|
|
|
|