Re: Apache 2.2 to Tomcat 6 via proxy_ajp

2009-05-28 Thread J. Zimmerman
Thanks for all of the replies.  I had tried most of the suggestions
previously, but things were still not working the way I wanted.
Specifically I could get it to work if I was willing to using
http://domain.com/appname, but not just http://domain.com/.

I had seen the Tomcat virtual hosting documentation, but overall we kind of
run a hybrid apache2 / apache tomcat environment so I needed to front end
everything through Apache2 mod_proxy_ajp.

It turns out I was *really* close and technically it was working.  The
Tomcat application (which is an Apache Wicket) was doing a redirect that
made a working config seem broken.

So here is my working (deemed working without major testing) for this
specific application.  Others may not require the Rewrite rule or may
require a different rewrite rule.

VirtualHost *:80
 ServerName  testproxy.domain.com

 RewriteEngine On
 RewriteRule ^/appname/(.*)$ http://testproxy.domain.com/$1 [L]

 ProxyPreserveHost   On

 ProxyPass / ajp://localhost:8009/appname/
 ProxyPassReverse / ajp://localhost:8009/appname/

 Proxy *
 Order allow,deny
 Allow from all
 /Proxy

 ErrorLog /var/log/apache2/testproxy.domain.com-error.log

 # Possible values include: debug, info, notice, warn, error, crit,
 # alert, emerg.
 LogLevel warn

 CustomLog /var/log/apache2/testproxy.domain.com-access.log combined
 ServerSignature Off
 /VirtualHost


Thanks to everyone who read or responded to this thread.


Re: Apache 2.2 to Tomcat 6 via proxy_ajp

2009-05-22 Thread Mark Thomas
J. Zimmerman wrote:
 I am just getting started with Tomcat and have been asked to take on the
 administration of our Tomcat servers at our college.  I am not one of the
 developers, just the administrator.  So far everything has gone pretty
 smoothly except for getting everything to run proxied via Apache (at least
 the way we would like it).
 
 Our requirement is for Tomcat to deliver the application through
 http://hostname:8080/appname and/or ajp://hostname:8009/appname.  This
 happens by default and works well.  However, we want end users to access the
 applications via port 443 or 80 and we are doing this via Apache.  I can
 make this work via proxy_ajp and proxy_http so that something like
 http://hostname/appname works just fine.
 
 The wrench in the works is that we want to do virtual hosting through Apache
 and not have the appname appended to it.  The Apache virtual hosted URL's
 will be the ones exposed to the public.
 
 For example if we developed an application called mycoolapp and we were
 deploying it at a website of the same name we would want the application to
 run at http://mycoolapp.com and not http://mycoolapp.com/mycoolapp.

Inside your virtual host, something like:

ProxyPass / http://tomcat.host:8080/mycoolapp/
ProxyPassReverse / http://tomcat.host:8080/mycoolapp/

should do the trick.

What have you tried and what, exactly, didn't work?

Mark



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



Re: Apache 2.2 to Tomcat 6 via proxy_ajp

2009-05-22 Thread Jim Jagielski


On May 21, 2009, at 10:28 PM, J. Zimmerman wrote:

I am just getting started with Tomcat and have been asked to take on  
the
administration of our Tomcat servers at our college.  I am not one  
of the

developers, just the administrator.  So far everything has gone pretty
smoothly except for getting everything to run proxied via Apache (at  
least

the way we would like it).

Our requirement is for Tomcat to deliver the application through
http://hostname:8080/appname and/or ajp://hostname:8009/appname.  This
happens by default and works well.  However, we want end users to  
access the
applications via port 443 or 80 and we are doing this via Apache.  I  
can

make this work via proxy_ajp and proxy_http so that something like
http://hostname/appname works just fine.

The wrench in the works is that we want to do virtual hosting  
through Apache
and not have the appname appended to it.  The Apache virtual hosted  
URL's

will be the ones exposed to the public.

For example if we developed an application called mycoolapp and we  
were
deploying it at a website of the same name we would want the  
application to

run at http://mycoolapp.com and not http://mycoolapp.com/mycoolapp.

I have hacked together several different configs suggested through  
many
different pieces of documentation and forums, but just can't seem to  
get it.


Our setup is as follows.

Server: Ubuntu 8.04 (all updates)
Java: Latest JDK download from Sun
Tomcat: Latest version 6 official download (configs are near  
defaults, I

have revereted to the default server.xml)
Apache: Latest version 2.2 via Ubuntu repositories.  proxy_ajp,  
proxy_http,

and rewrite enabled.

If anyone has suggestions or a working example any help is greatly
appreciated.


ProxyPass / http://hostname:8080/mycoolapp

-or-

ProxyPass / ajp://hostname:8080/mycoolapp

Assuming hostname:8080 is the Tomcat server

No need for rewrite at all.

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



Re: Apache 2.2 to Tomcat 6 via proxy_ajp

2009-05-22 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Chuck,

On 5/21/2009 11:43 PM, Caldarale, Charles R wrote:
 From: J. Zimmerman [mailto:john.z...@gmail.com] Subject: Apache 2.2
 to Tomcat 6 via proxy_ajp
 
 The wrench in the works is that we want to do virtual hosting
 through Apache and not have the appname appended to it.  The Apache
 virtual hosted URL's will be the ones exposed to the public.
 
 Do you really need httpd in the game?  Is it providing any useful
 service (e.g., PHP)?  If not, remove it and simplify your life.

+1

 If you must have httpd in the picture, mod_rewrite might help if the
 Tomcat virtual hosting is insufficient (but perhaps you've already
 tried that).

I'm not sure mod_rewrite is necessary. Instead, you can do something
like this:

VirtualHost *:80
  ServerName mycoolapp.com


  ProxyPass / ajp://host:8009/mycoolapp
/VirtualHost

You could also get away with:

VirtualHost *:80
  ServerName mycoolapp.com


  ProxyPass / ajp://host:8009/
/VirtualHost

...if you deploy mycoolapp as the ROOT context.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkoWp10ACgkQ9CaO5/Lv0PARvQCfVLmzTfeXl7W3xqEc8LOsMXu7
6voAoJizHcvoTPBCgJB9JSqmTeJFSPv2
=2zTC
-END PGP SIGNATURE-

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



Apache 2.2 to Tomcat 6 via proxy_ajp

2009-05-21 Thread J. Zimmerman
I am just getting started with Tomcat and have been asked to take on the
administration of our Tomcat servers at our college.  I am not one of the
developers, just the administrator.  So far everything has gone pretty
smoothly except for getting everything to run proxied via Apache (at least
the way we would like it).

Our requirement is for Tomcat to deliver the application through
http://hostname:8080/appname and/or ajp://hostname:8009/appname.  This
happens by default and works well.  However, we want end users to access the
applications via port 443 or 80 and we are doing this via Apache.  I can
make this work via proxy_ajp and proxy_http so that something like
http://hostname/appname works just fine.

The wrench in the works is that we want to do virtual hosting through Apache
and not have the appname appended to it.  The Apache virtual hosted URL's
will be the ones exposed to the public.

For example if we developed an application called mycoolapp and we were
deploying it at a website of the same name we would want the application to
run at http://mycoolapp.com and not http://mycoolapp.com/mycoolapp.

I have hacked together several different configs suggested through many
different pieces of documentation and forums, but just can't seem to get it.

Our setup is as follows.

Server: Ubuntu 8.04 (all updates)
Java: Latest JDK download from Sun
Tomcat: Latest version 6 official download (configs are near defaults, I
have revereted to the default server.xml)
Apache: Latest version 2.2 via Ubuntu repositories.  proxy_ajp, proxy_http,
and rewrite enabled.

If anyone has suggestions or a working example any help is greatly
appreciated.


RE: Apache 2.2 to Tomcat 6 via proxy_ajp

2009-05-21 Thread Caldarale, Charles R
 From: J. Zimmerman [mailto:john.z...@gmail.com]
 Subject: Apache 2.2 to Tomcat 6 via proxy_ajp
 
 The wrench in the works is that we want to do virtual hosting through
 Apache and not have the appname appended to it.  The Apache virtual 
 hosted URL's will be the ones exposed to the public.

Do you really need httpd in the game?  Is it providing any useful service 
(e.g., PHP)?  If not, remove it and simplify your life.

Look here for how to do virtual hosting in Tomcat:
http://tomcat.apache.org/tomcat-6.0-doc/virtual-hosting-howto.html

If you must have httpd in the picture, mod_rewrite might help if the Tomcat 
virtual hosting is insufficient (but perhaps you've already tried that).

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.


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