You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Cox, Charlie" <cc...@cincom.com> on 2004/04/23 21:05:26 UTC

[users@httpd] virtual host problem

Versions: Apache 2.0.49/jk2.0.4

I have named virtual hosts set up and that is working ok. 

DocumentRoot /myroot
ErrorLog "| cronolog.exe /mylogs/main_error.log

NameVirtualHost 10.10.10.10:80
<VirtualHost 10.10.10.10:80>
    ServerName foo.bar.com:80
    ServerAdmin foobar@foobar.com
    DocumentRoot /foo/bar
    DirectoryIndex index.html
    CustomLog "| cronolog.exe /mylogs/foobar_access.log" combined
    ErrorLog "| cronolog.exe /mylogs/foobar_error.log
      
    <Directory /foo/bar>
        Options -Indexes -FollowSymLinks
        AllowOverride None
    </Directory>
</VirtualHost>


However I have no virtual host set up when a host name is not
provided(http://10.10.10.10). But somehow the error of 'directory index
denied for /' gets logged to the foobar_error.log instead of the main error
log. However the request is not logged to foobar_access.log. 

One more thing is that I am using mod_jk2 and requests to the domain name
for *.html are sent to tomcat. However it is not doing that for the
ipaddress request because I have not defined 10.10.10.10/*.html in the
workers2.properties. I understand and expect this jk2 behavior. 
However, if I place an index.html in /foo/bar then the request to
10.10.10.10 will pick it up instead of using the 'main' document root.

I think that I need a block like the following to redirect any other
requests to my virtual host: 

<VirtualHost 10.10.10.10:80>
	ServerName default:80
	#do whatever
</VirtualHost>

My real interest is in understanding what is going on here. I want to know
why this behavior is inconsistent as to when it uses the virtual host vs.
the main settings. My understanding was that a whole request(not just a
directive) either matches a <VirutalHost> or it uses the 'main' settings. Is
this a wrong assumption? 

thanks,
Charlie


Re: [users@httpd] virtual host problem

Posted by Aaron W Morris <aa...@mindspring.com>.
Cox, Charlie wrote:
> Versions: Apache 2.0.49/jk2.0.4
> 
> I have named virtual hosts set up and that is working ok. 
> 
> DocumentRoot /myroot
> ErrorLog "| cronolog.exe /mylogs/main_error.log
> 
> NameVirtualHost 10.10.10.10:80
> <VirtualHost 10.10.10.10:80>
>     ServerName foo.bar.com:80
>     ServerAdmin foobar@foobar.com
>     DocumentRoot /foo/bar
>     DirectoryIndex index.html
>     CustomLog "| cronolog.exe /mylogs/foobar_access.log" combined
>     ErrorLog "| cronolog.exe /mylogs/foobar_error.log
>       
>     <Directory /foo/bar>
>         Options -Indexes -FollowSymLinks
>         AllowOverride None
>     </Directory>
> </VirtualHost>
> 
> 
> However I have no virtual host set up when a host name is not
> provided(http://10.10.10.10). But somehow the error of 'directory index
> denied for /' gets logged to the foobar_error.log instead of the main error
> log. However the request is not logged to foobar_access.log. 
> 
> One more thing is that I am using mod_jk2 and requests to the domain name
> for *.html are sent to tomcat. However it is not doing that for the
> ipaddress request because I have not defined 10.10.10.10/*.html in the
> workers2.properties. I understand and expect this jk2 behavior. 
> However, if I place an index.html in /foo/bar then the request to
> 10.10.10.10 will pick it up instead of using the 'main' document root.
> 
> I think that I need a block like the following to redirect any other
> requests to my virtual host: 
> 
> <VirtualHost 10.10.10.10:80>
> 	ServerName default:80
> 	#do whatever
> </VirtualHost>
> 
> My real interest is in understanding what is going on here. I want to know
> why this behavior is inconsistent as to when it uses the virtual host vs.
> the main settings. My understanding was that a whole request(not just a
> directive) either matches a <VirutalHost> or it uses the 'main' settings. Is
> this a wrong assumption? 
> 
> thanks,
> Charlie
> 
> 

I can answer your log question.  Once you enable name based virtual 
hosting (NBVH), if a request comes in matching the IP/port combo for the 
NBVHs and a host header match is not found, the request will always 
default to the first VH.

-- 
Aaron W Morris <aa...@mindspring.com> (decep)



---------------------------------------------------------------------
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 host problem

Posted by Dishko Georgiev <di...@rozabg.com>.
virtual host problemHi,

to get Named Virtual hosts to work u need DNS resolve for hosts.
i'm doing it like this:

my.real.domain.com A xxx.xxx.xxx.xxx
www.some.domain.com CNAME my.real.domain.com.

and it work fine.
  ----- Original Message ----- 
  From: Cox, Charlie 
  To: users@httpd.apache.org 
  Sent: Friday, April 23, 2004 10:05 PM
  Subject: [users@httpd] virtual host problem


  Versions: Apache 2.0.49/jk2.0.4 

  I have named virtual hosts set up and that is working ok. 

  DocumentRoot /myroot 
  ErrorLog "| cronolog.exe /mylogs/main_error.log 

  NameVirtualHost 10.10.10.10:80 
  <VirtualHost 10.10.10.10:80> 
      ServerName foo.bar.com:80 
      ServerAdmin foobar@foobar.com 
      DocumentRoot /foo/bar 
      DirectoryIndex index.html 
      CustomLog "| cronolog.exe /mylogs/foobar_access.log" combined 
      ErrorLog "| cronolog.exe /mylogs/foobar_error.log 
        
      <Directory /foo/bar> 
          Options -Indexes -FollowSymLinks 
          AllowOverride None 
      </Directory> 
  </VirtualHost> 



  However I have no virtual host set up when a host name is not provided(http://10.10.10.10). But somehow the error of 'directory index denied for /' gets logged to the foobar_error.log instead of the main error log. However the request is not logged to foobar_access.log. 

  One more thing is that I am using mod_jk2 and requests to the domain name for *.html are sent to tomcat. However it is not doing that for the ipaddress request because I have not defined 10.10.10.10/*.html in the workers2.properties. I understand and expect this jk2 behavior. 

  However, if I place an index.html in /foo/bar then the request to 10.10.10.10 will pick it up instead of using the 'main' document root.

  I think that I need a block like the following to redirect any other requests to my virtual host: 

  <VirtualHost 10.10.10.10:80> 
          ServerName default:80 
          #do whatever 
  </VirtualHost> 

  My real interest is in understanding what is going on here. I want to know why this behavior is inconsistent as to when it uses the virtual host vs. the main settings. My understanding was that a whole request(not just a directive) either matches a <VirutalHost> or it uses the 'main' settings. Is this a wrong assumption? 

  thanks, 
  Charlie