You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by MK <ha...@intergate.com> on 2009/10/20 17:07:27 UTC

[users@httpd] Virtual Hosts problem

I have two virtual hosts set-up and working at home right now.  The 
first one is this:

NameVirtualHost *:80
<VirtualHost *:80>
    ServerName localhost
    DocumentRoot "/var/www/html/"
        Alias /filesystem /
        RewriteEngine On
        RewriteCond %{HTTP_USER_AGENT}  MSIE.6
        RewriteRule .m?html$ http://localhost/IE6.htm        [L]
</VirtualHost>

The second one is a ruby on rails site.  I put both these in a while 
ago, and went to add a third one today since as far as I can remember, 
and AFAICT looking at the docs, it was as simple as this:

<VirtualHost *:80>
    ServerName dev.docsearch.net
    DocumentRoot "/var/www/html/searchtest/mirror/"
</VirtualHost>

Then I restarted apache.  However, no matter what directory I point 
this to (including the ones in the other Virtual hosts directives, I 
get an "Address not found" error from the browser.  Strangely, if I 
move the *exact same DocumentRoot line* into one of the working 
VirtualHosts, that directory works.  In other words THERE ARE NO 
SPELLING ERRORS OR MISTAKES IN THE PATHS, ETC.  And no typos in the nav 
bar either.  Promise.

Using apachectl -S shows "port 80 namevhost dev.docsearch.net ... 
Syntax OK"

There is no output in either the access or error log.  What have I 
missed?  Why is the configuration above not sufficient?

ps. Server version: Apache/2.2.10 (Unix)



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Virtual Hosts problem

Posted by André Warnier <aw...@ice-sa.com>.
MK wrote:
> On 10/20/2009 11:26:45 AM, André Warnier wrote:
> 
>> What do you get when you enter :
>> ping dev.docsearch.net
>> in a command window on your workstation ?
> 
> On the working VH's, the ping goes thru.  On the non-working one, I get 
> "unknown host".
> 
> I'm totally baffled by this.  I keep staring at everything looking for 
> a typo, but again, there isn't one...
> 
When you enter a URL like "http://dev.docsearch.net/something" in the 
URL bar of your browser, the first thing the browser has to do, is 
resolve the hostname "dev.docsearch.net" to an IP address.
If it cannot do that, then it can never set up a TCP connection to that 
host, never mind sending it a request.
No wonder thus that Apache never receives it..

So the first thing you have to do, is arrange for your browser to be 
able to resolve "dev.docsearch.net" to an IP address.
Depending on your setup, and whether this is only for testing or you 
want other workstations to also access that VirtualHost, the solution 
differs.

If your browser workstation is the same computer as the one where Apache 
is running, and this is just for testing, then just do this :
- find your "hosts" file (in Windows, this is in 
C:/windows/system32/drivers/etc/hosts, in Unix/Linux it is /etc/hosts)
- add a line like this :
127.0.0.1 dev.docsearch.net
- save the file
- close and re-open your browser, and try again

If you are not in the above conditions, then you need to ask the 
sysadmin responsible for DNS in your network, to add "dev.docsearch.net" 
to the list of aliases for your Apache host computer.

Note that this is basic TCP/IP stuff, not really an Apache issue.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Virtual Hosts problem

Posted by Drew Tomlinson <dr...@mykitchentable.net>.
Drew Tomlinson wrote:
> MK wrote:
>> On 10/20/2009 11:26:45 AM, André Warnier wrote:
>>
>>  
>>> What do you get when you enter :
>>> ping dev.docsearch.net
>>> in a command window on your workstation ?
>>>     
>>
>> On the working VH's, the ping goes thru.  On the non-working one, I 
>> get "unknown host".
>>
>> I'm totally baffled by this.  I keep staring at everything looking 
>> for a typo, but again, there isn't one...
>
> So you do not have a virtual host problem.  You have a name resolution 
> problem.  dev.docsearch.net has resolve to the IP address of your web 
> server.  You can test this by adding an entry for dev.docsearch.net to 
> the hosts file on your workstation.
>
> Cheers,
>
> Drew 
Sorry for the noise.  Seems I didn't scroll completely to the bottom 
before replying and thus, didn't see Andre's reply.

Cheers,

Drew

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Virtual Hosts problem

Posted by Drew Tomlinson <dr...@mykitchentable.net>.
MK wrote:
> On 10/20/2009 11:26:45 AM, André Warnier wrote:
>
>   
>> What do you get when you enter :
>> ping dev.docsearch.net
>> in a command window on your workstation ?
>>     
>
> On the working VH's, the ping goes thru.  On the non-working one, I get 
> "unknown host".
>
> I'm totally baffled by this.  I keep staring at everything looking for 
> a typo, but again, there isn't one...

So you do not have a virtual host problem.  You have a name resolution 
problem.  dev.docsearch.net has resolve to the IP address of your web 
server.  You can test this by adding an entry for dev.docsearch.net to 
the hosts file on your workstation.

Cheers,

Drew


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Virtual Hosts problem

Posted by MK <ha...@intergate.com>.
Hey thanks y'all, it was the name resolution.  As soon as I saw that, 
bells started ringing and of course the other VH's (eg, localhost) have 
an entry there.  

Thanks!

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Virtual Hosts problem

Posted by MK <ha...@intergate.com>.
On 10/20/2009 11:26:45 AM, André Warnier wrote:

> What do you get when you enter :
> ping dev.docsearch.net
> in a command window on your workstation ?

On the working VH's, the ping goes thru.  On the non-working one, I get 
"unknown host".

I'm totally baffled by this.  I keep staring at everything looking for 
a typo, but again, there isn't one...




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Virtual Hosts problem

Posted by André Warnier <aw...@ice-sa.com>.
MK wrote:
..
> <VirtualHost *:80>
>     ServerName dev.docsearch.net
>     DocumentRoot "/var/www/html/searchtest/mirror/"
> </VirtualHost>
> 
> Then I restarted apache.  However, no matter what directory I point 
> this to (including the ones in the other Virtual hosts directives, I 
> get an "Address not found" error from the browser.  

What do you get when you enter :
ping dev.docsearch.net
in a command window on your workstation ?




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org