Angelo Chen wrote:
Hi,
My purpose is:
http://192.168.1.1 goes to Apache HTTP server
www.myexample.com goes to my tomcat server
but this goes always to my tomcat server, any idea?
Thanks
Try inserting this *before* the other VirtualHost below :
<VirtualHost *:80>
ServerName localhost
DocumentRoot .....
....
</VirtualHost>
<VirtualHost *:80>
ServerName www.myexample.com
ProxyPass / ajp://localhost:8009/
ProxyRequests Off
ProxyPassReverse / ajp://localhost:8009/
ProxyPreserveHost On
</VirtualHost>
Short explanation :
The *first* VirtualHost you define, is the *default* host.
It will "catch" all requests that do not specifically match a
"ServerName" defined in any of the other VirtualHost sections.
As "ServerName" above, I put "localhost", but basically you can use
anything that does not match the other "ServerName" directives in the
other VirtualHos sections.
Longer explanation :
Under HTTP 1.1, requests to your server look like this :
GET /url HTTP/1.1
Host: somehost.somecompany.com
When Apache gets this, it tries to match the name given in the Host:
header, to one of the "ServerName" directives of the <VirtualHost>
sections. It this match succeeds, Apache will serve this request using
the "personality" (the configuration) of the matching VirtualHost.
If it does not succeed, then Apache will serve the request using the
"personality" (the configuration) of the first-defined VirtualHost, no
matter what that one says in its "ServerName" line.
That is why this first-defined VirtualHost is know as "the default host"
: it will answer anything that Apache doesn't really know what to do
with, so to speak.
Even longer explanation :
With your original configuration, the single <VirtualHost> section is,
at the same time, the VH with ServerName "www.myexample.com", AND the
default VirtualHost (because it is the first VH defined).
So, no matter which hostname is used in the request, as long as the
request ultimately arrives to Apache, it will be served with the
personality of that VirtualHost.
And, in your configuration of that VirtualHost, you redirect
/everything/ to Tomcat. So what happens is quite normal.
---------------------------------------------------------------------
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: [EMAIL PROTECTED]
" from the digest: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]