I have a problem with my Apache and Tomcat configuration. I have an Apache instance as a proxy to Tomcat. The Tomcat serves two virtual hosts. The problem occurs when one Apache virtual points to particular virtual in Tomcat. I can show in on my config files:
/etc/hosts:
127.0.0.1 localhost
127.0.0.1 my-pages
/etc/apache/sites-enabled/my-pages.tld:
<VirtualHost *:80>
RewriteEngine on
ServerAdmin webmaster@my-pages.tld
ServerName www.my-pages.tld
ServerAlias my-pages.tld
ProxyPass / http://my-pages:9082/
ProxyPassReverse / http://my-pages:9082/
# Logs
ErrorLog /usr/local/tomcat2/logs/error.log
CustomLog /usr/local/tomcat2/logs/access.log common
LogLevel debug
</VirtualHost>
<Proxy *>
Order deny,allow
Allow from all
Deny from all
</Proxy>
ProxyRequests Off
ProxyPreserveHost Off
${CATALINA_HOME}/conf/server.xml
...
<Connector port="8081" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8444"
URIEncoding="UTF-8" />
<Connector port="9082" proxyPort="80" proxyName="my-pages" />
...
<Host name="my-pages" appBase="my-pages"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context path="" docBase="envelon-web" />
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="my-pages_access_" suffix=".log" pattern="common" resolveHosts="false"/>
</Host>
When I run this configuration the www.my-pages.tld pages points to the default virtual host in Tomcat (not to the "my-pages" virtual). It is quite strange, because when I set the same configuration on my local machine (not on server), it works fine. Also when I use domain name in the Tomcat virtual (my-pages.tld instead of my-pages) it also works (I don't want to use this config. cause I want to "hide" Tomcat from outside).
Do you know where I'm wrong or what will fix this problem? Thanks for any response!
Mateo