tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: url prefixes behind proxy
Date Fri, 07 Jan 2011 15:17:58 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Gabor,

On 1/6/2011 11:54 PM, Gabor Pinter wrote:
> Dear Christopher,
> 
> Thank you for your reply.
> 
>>> Tomcat is version 6.0
>>
>> 6.0.what? We're just dying to know.
> 
> Sorry, it's 6.0.29 .
> (Though at my level, the third digit may be of minor importance :)

It's always good to check that you're not running 6.0.17 or some other
version that was never actually released.

>> http://localhost:8080/tom     ->    path/to/tomcat/webapps/tom
>>> http://localhost:80/tom/     ->    path/to/tomcat/webapps/
>>
>> My example above is better because it will actually work.
> 
> I can see that.
> But doesn't this mean that you need to add a proxy_pass for each app you
> deploy under webapp?

You will need a ProxyPass for each logical URL group you want to send to
Tomcat. If you want to send everything to Tomcat, you can just do:

ProxyPass / ajp://localhost/

You could also put everything behind another URL prefix... something like:

ProxyPass /webapps ajp://localhost/webapps

Then, you'd want to deploy your webapps like this:

webapps/webapps#tom.war
webapps/webapps#foo.war
webapps/webapps#bar (a directory example)

> Plus the root app in Tomcat also needed to be moved from "/".

What do you need the root app for?

> I can live with that, I'm just curious if it is possible to use
> a global prefix ('/tom' is a bad example, say '/servlet') for a
> redirection.

Okay:

ProxyPass /servlet ajp://localhost/servlet

> http://localhost:8080/servlet/  -->  path/to/tomcat/webapps/

Note that you never map a URL to a directory. You map it to a webapp
which is deployed on that URL. path/to/tomcat/webapps is not a webapp,
it's a directory that is treated specially by the default Tomcat
configuration by auto-deploying webapps that appear there as directories
or .war files.

If you use "ProxyPass /servlet ajp://localhost/servlet" then you'll want
to make sure that your webapps are deployed into contexts with a
/servlet prefix. You do that using servlet#webappname.war (or without
the .war if it's an exploded WAR file). If you want
http://localhost:8080/servlet/tom to take you to the "tom" webapp,
you'll want to deploy it into:

path/to/tomcat/webapps/servlet#tom.war (or a directory w/o the .war)

>>> nginx -->  apache -->  django
>>> setup on the server (working just fine).
>>
>> Aah, unnecessary complexity: I just love it.
> 
> The concept is from an Apress django book.
> Would you live nginx out? Or Apache?
> Or django?

If you need to mix technologies such as Perl, PHP, python, etc. along
with Java, the simplest way is to use a web proxy such as squid, Apache
httpd, or NginX. It's the combination of everything that seems
overly-complicated to me.

Presumably, django is a requirement. Do you use it under a typical
python environment, or do you use Jython or something like that? If you
are using Jython and everything is running in your webapp, why not dump
all those proxies (httpd and NginX) and just use Tomcat directly?

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

iEYEARECAAYFAk0nLqYACgkQ9CaO5/Lv0PD4sACgvN7gHGL9PQ7MfXdAAopvEjcX
rA8An0OA+VNgBaTa82zTLGmT00MRLXK5
=XCL+
-----END PGP SIGNATURE-----

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


Mime
View raw message