tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tobias Crefeld ...@cataneo.eu>
Subject Re: virtual host for apache/tomcat server
Date Wed, 30 Mar 2011 22:57:06 GMT
Am Wed, 30 Mar 2011 15:09:12 -0400 schrieb James Pifer
<jep@obrien-pifer.com>:

> ´╗┐Ok, my httpd.conf is pretty standard. It includes proxy_ajp.conf
> which has:
> 
> LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
> ProxyPass /tomcat/ ajp://localhost:8009/

I only have some experience with Tomcat-6, not Tomcat-5.5, so maybe
there are some mistakes in my posting, but AFAIK:
 - A corresponding ProxyPassReverse is missing. 
 - If you want to redirect requests to http://hostname.domain.tld/ to
ROOT then you should simply write "/" and not "/tomcat/".

Maybe a chip of our mixed IP- and name-based Apache-vhost-configs gives
you an idea of how to setup Apache2 (in this environment hostnames with
TLD "prod" are private IP-adresses for internal access). 

The setup uses a mix of mod_proxy_http and mod_proxy_ajp. Of course you
have to configure tomcat's server.xml to offer ajp-access via Port
8009. Usually mod_proxy_ajp works better (handling of out-buffer,
cache ontrol) but in rare cases we had problems with mod_proxy_ajp.

Of course httpd.conf of our apache2.2 has got an include-statement
for /srv/conf.d/*.conf in order to use this config.

---------------------------snip---------------------------
[crm@mikesch ~]$ cat /srv/conf.d/crm.conf
#
# vhost-configuration *.crm.company.*
#
# Virtual IP-Alias via DNS
NameVirtualHost crm.company.prod:80
#                     
# vhost for production
#
<VirtualHost crm.company.prod:80>
  DocumentRoot /srv/crm/html
  ServerName crm.company.de
  ServerAlias crm.company.prod
  ErrorLog /srv/crm/logs/error_log
  TransferLog /srv/crm/logs/access_log
# Reverse-Proxy for ajp-connector
  ProxyRequests Off
  <Proxy *>
    Order deny,allow
    Allow from all
  </Proxy>
# avoid public access to mgmt-applications
  ProxyPass        /docs !
  ProxyPass        /probe !
  ProxyPass        /manager !
# connecting tomcats ROOT via mod_proxy_http and coyote
  ProxyPass        / http://crm.company.prod:8080/
  ProxyPassReverse / http://crm.company.prod:8080/
# alternative: connecting tomcats ROOT via ajp
#  ProxyPass        / ajp://crm.company.prod:8009/                         
#  ProxyPassReverse / ajp://crm.company.prod:8009/
</VirtualHost>
#
# allow vhost for management only for users in private network
#
<VirtualHost crm.cataneo.prod:80>                                               
  DocumentRoot /srv/crm/html/mgmt
  ServerName mgmt.crm.cataneo.prod
  ErrorLog /srv/crm/logs/error_log
  TransferLog /srv/crm/logs/access_log
# Displaying Apache vhost-statistics under /usage
  Alias /usage /srv/crm/html/mgmt/usage
  <Location /usage>
    Order deny,allow
    Deny from all
    Allow from 127.0.0.1
    Allow from ::1
    Allow from company.prod
  </Location>
# Reverse-Proxy fuer ajp-connector
  ProxyRequests Off
  <Proxy *>
    Order deny,allow
    Deny from all
    Allow from 127.0.0.1
    Allow from ::1
    Allow from company.prod
  </Proxy>
  ProxyPass        /probe   ajp://crm.cataneo.prod:8009/probe
  ProxyPassReverse /probe   ajp://crm.cataneo.prod:8009/probe
  ProxyPass        /manager ajp://crm.cataneo.prod:8009/manager
  ProxyPassReverse /manager ajp://crm.cataneo.prod:8009/manager
  ProxyPass        /docs    ajp://crm.cataneo.prod:8009/docs
  ProxyPassReverse /docs    ajp://crm.cataneo.prod:8009/docs
</VirtualHost>
---------------------------snip---------------------------



RU,
 Tobias.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message