You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Thomas Rohde <tr...@ordix.de> on 2012/01/29 11:09:47 UTC
Re: Tomcat 6 - How to make an application available at
www.mydomain.com
> I'm running tomcat 6 behind apache.
>
> I currently have an application deployed as "myApplication" and it is
> available at "http://www.mydomain.com/myApplication".
>
> How can I make this application available at "http://www.mydomain.com"
> without deploying it as ROOT.war?
>
> My server is running Ubuntu 10.04.
>
> Thanks!
>
> Dean Del Ponte
>
You could use a rewrite rule to achieve that:
RewriteEngine On
RewriteRule ^/$ /myApplication/ [PT]
JkMount /myApplication* tomcat
Works for me very well.
Thomas
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat 6 - How to make an application available at www.mydomain.com
Posted by Pid <pi...@pidster.com>.
On 29/01/2012 10:46, Borut Hadžialić wrote:
> Hi,
>
> the best way is to deploy your application to run inside tomcat
> without a context path - eg. to be available at http://localhost:8080/
> instead of http://localhost:8080/myApplication and use your apache
> reverse proxying / virtual host as it is.
>
> Trying to strip application context in virtual host configuration in
> my expirience was troublesome in some of my expiriences and now I
> always try to avoid it.
>
> What do you mean exactly by "without deploying it as ROOT.war"?
>
> You can set the context path of your Tomcat deployed applications to
> whatever you want - context path doesn't have to be the same as .war
> archive name. Just stop using deployment trough webapps directory and
> start using context files inside tomcat-x.x.x/conf directory to define
> your applications (all explained here
> http://tomcat.apache.org/tomcat-6.0-doc/config/context.html ), for
> example:
>
> 1. Make a file called
> ${catalina.base}/conf/Catalina/localhost.ROOT.xml that contains:
>
> <?xml version='1.0' encoding='utf-8'?>
> <Context docBase="${catalina.base}/war/myApplication.war" path="">
> <Manager pathname=""/>
> </Context>
The path attribute is not valid here.
p
> 2. Copy you myApplication.war to ${catalina.base}/war - or some other
> directory if you want to arange things differently.
>
> 3. Remove myApplication.war from ${catalina.base}/webapps
>
> Where ${catalina.base} is you current tomcat installation (or base
> instance) where you are currently deploying you app.
>
>
>
> On 1/29/12, Thomas Rohde <tr...@ordix.de> wrote:
>>> I'm running tomcat 6 behind apache.
>>>
>>> I currently have an application deployed as "myApplication" and it is
>>> available at "http://www.mydomain.com/myApplication".
>>>
>>> How can I make this application available at "http://www.mydomain.com"
>>> without deploying it as ROOT.war?
>>>
>>> My server is running Ubuntu 10.04.
>>>
>>> Thanks!
>>>
>>> Dean Del Ponte
>>>
>>
>> You could use a rewrite rule to achieve that:
>>
>> RewriteEngine On
>> RewriteRule ^/$ /myApplication/ [PT]
>> JkMount /myApplication* tomcat
>>
>> Works for me very well.
>>
>> Thomas
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>
>
--
[key:62590808]
Re: Tomcat 6 - How to make an application available at www.mydomain.com
Posted by Borut Hadžialić <bo...@gmail.com>.
Just a small correction:
1. Make a file called
${catalina.base}/conf/Catalina/localhost/ROOT.xml that contains:
instead of
1. Make a file called
${catalina.base}/conf/Catalina/localhost.ROOT.xml that contains:
On 1/29/12, Borut Hadžialić <bo...@gmail.com> wrote:
> Hi,
>
> the best way is to deploy your application to run inside tomcat
> without a context path - eg. to be available at http://localhost:8080/
> instead of http://localhost:8080/myApplication and use your apache
> reverse proxying / virtual host as it is.
>
> Trying to strip application context in virtual host configuration in
> my expirience was troublesome in some of my expiriences and now I
> always try to avoid it.
>
> What do you mean exactly by "without deploying it as ROOT.war"?
>
> You can set the context path of your Tomcat deployed applications to
> whatever you want - context path doesn't have to be the same as .war
> archive name. Just stop using deployment trough webapps directory and
> start using context files inside tomcat-x.x.x/conf directory to define
> your applications (all explained here
> http://tomcat.apache.org/tomcat-6.0-doc/config/context.html ), for
> example:
>
> 1. Make a file called
> ${catalina.base}/conf/Catalina/localhost.ROOT.xml that contains:
>
> <?xml version='1.0' encoding='utf-8'?>
> <Context docBase="${catalina.base}/war/myApplication.war" path="">
> <Manager pathname=""/>
> </Context>
>
> 2. Copy you myApplication.war to ${catalina.base}/war - or some other
> directory if you want to arange things differently.
>
> 3. Remove myApplication.war from ${catalina.base}/webapps
>
> Where ${catalina.base} is you current tomcat installation (or base
> instance) where you are currently deploying you app.
>
>
>
> On 1/29/12, Thomas Rohde <tr...@ordix.de> wrote:
>>> I'm running tomcat 6 behind apache.
>>>
>>> I currently have an application deployed as "myApplication" and it is
>>> available at "http://www.mydomain.com/myApplication".
>>>
>>> How can I make this application available at "http://www.mydomain.com"
>>> without deploying it as ROOT.war?
>>>
>>> My server is running Ubuntu 10.04.
>>>
>>> Thanks!
>>>
>>> Dean Del Ponte
>>>
>>
>> You could use a rewrite rule to achieve that:
>>
>> RewriteEngine On
>> RewriteRule ^/$ /myApplication/ [PT]
>> JkMount /myApplication* tomcat
>>
>> Works for me very well.
>>
>> Thomas
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>
>
> --
> Why?
> Because YES!
>
--
Why?
Because YES!
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat 6 - How to make an application available at www.mydomain.com
Posted by Borut Hadžialić <bo...@gmail.com>.
Hi,
the best way is to deploy your application to run inside tomcat
without a context path - eg. to be available at http://localhost:8080/
instead of http://localhost:8080/myApplication and use your apache
reverse proxying / virtual host as it is.
Trying to strip application context in virtual host configuration in
my expirience was troublesome in some of my expiriences and now I
always try to avoid it.
What do you mean exactly by "without deploying it as ROOT.war"?
You can set the context path of your Tomcat deployed applications to
whatever you want - context path doesn't have to be the same as .war
archive name. Just stop using deployment trough webapps directory and
start using context files inside tomcat-x.x.x/conf directory to define
your applications (all explained here
http://tomcat.apache.org/tomcat-6.0-doc/config/context.html ), for
example:
1. Make a file called
${catalina.base}/conf/Catalina/localhost.ROOT.xml that contains:
<?xml version='1.0' encoding='utf-8'?>
<Context docBase="${catalina.base}/war/myApplication.war" path="">
<Manager pathname=""/>
</Context>
2. Copy you myApplication.war to ${catalina.base}/war - or some other
directory if you want to arange things differently.
3. Remove myApplication.war from ${catalina.base}/webapps
Where ${catalina.base} is you current tomcat installation (or base
instance) where you are currently deploying you app.
On 1/29/12, Thomas Rohde <tr...@ordix.de> wrote:
>> I'm running tomcat 6 behind apache.
>>
>> I currently have an application deployed as "myApplication" and it is
>> available at "http://www.mydomain.com/myApplication".
>>
>> How can I make this application available at "http://www.mydomain.com"
>> without deploying it as ROOT.war?
>>
>> My server is running Ubuntu 10.04.
>>
>> Thanks!
>>
>> Dean Del Ponte
>>
>
> You could use a rewrite rule to achieve that:
>
> RewriteEngine On
> RewriteRule ^/$ /myApplication/ [PT]
> JkMount /myApplication* tomcat
>
> Works for me very well.
>
> Thomas
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
--
Why?
Because YES!
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat 6 - How to make an application available at
www.mydomain.com
Posted by Thomas Rohde <tr...@ordix.de>.
> André Warnier wrote:
>> Thomas Rohde wrote:
>>>> I'm running tomcat 6 behind apache.
>>>>
>>>> I currently have an application deployed as "myApplication" and it is
>>>> available at "http://www.mydomain.com/myApplication".
>>>>
>>>> How can I make this application available at "http://www.mydomain.com"
>>>> without deploying it as ROOT.war?
>>>>
>>>> My server is running Ubuntu 10.04.
>>>>
>>>> Thanks!
>>>>
>>>> Dean Del Ponte
>>>>
>>>
>>> You could use a rewrite rule to achieve that:
>>>
>>> RewriteEngine On
>>> RewriteRule ^/$ /myApplication/ [PT]
>>> JkMount /myApplication* tomcat
>>>
>>> Works for me very well.
>>>
>>
>> That is assuming that the OP has an Apache httpd front-end, which he
>> never said.
>
> Ooops, he did...
>
>> Also, even if he has, the above is not enough except in the simplest of
>> cases.
>> As far as I can tell also, this RewriteRule only rewrites requests to
>> "/".
>> If that is enough to make it work for you, then one could wonder why you
>> need an httpd front-end in the first place.
This is a virtual host specific configuration and so it doesn't affect the
whole apache web server.
>> Note also that the JkMount above will not only proxy "/myApplication"
>> and "/myApplication/*", but just as well "/myApplication_as_a_prefix"
>> and anything else starting with "myApplication". This may or may not be
>> what you want, in terms of security for example.
>>
>> Chuck's recommendation is still the best.
>> The above notes already illustrate some of the reasons.
>> Let's see if the OP really has a good reason /not to/ deploy his
>> application as ROOT.
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat 6 - How to make an application available at
www.mydomain.com
Posted by Thomas Rohde <tr...@ordix.de>.
> Thomas Rohde wrote:
>>
>> That is a good point. I will change my configuration to
>>
>> JkMount /myApplication/* tomcat
>>
> Actually, you need 2 lines to cover all :
>
> > JkMount /myApplication tomcat # for the index ?
> > JkMount /myApplication/* tomcat # for the rest
Yes, I've already figured that out.
>
> Or you can use the following syntax :
>
> <Location /myApplication>
> SetHandler jakarta-servlet
> ...
> </Location>
That was actually new for me. I'll try it next time. Thank you!
>
> I personally like this second form better : it fits better with the
> general Apache httpd
> configuration style, and it allows for other httpd-level things in the
> same section.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat 6 - How to make an application available at
www.mydomain.com
Posted by André Warnier <aw...@ice-sa.com>.
Thomas Rohde wrote:
>
> That is a good point. I will change my configuration to
>
> JkMount /myApplication/* tomcat
>
Actually, you need 2 lines to cover all :
> JkMount /myApplication tomcat # for the index ?
> JkMount /myApplication/* tomcat # for the rest
Or you can use the following syntax :
<Location /myApplication>
SetHandler jakarta-servlet
...
</Location>
I personally like this second form better : it fits better with the general Apache httpd
configuration style, and it allows for other httpd-level things in the same section.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat 6 - How to make an application available at
www.mydomain.com
Posted by Thomas Rohde <tr...@ordix.de>.
> André Warnier wrote:
>> Thomas Rohde wrote:
>>>> I'm running tomcat 6 behind apache.
>>>>
>>>> I currently have an application deployed as "myApplication" and it is
>>>> available at "http://www.mydomain.com/myApplication".
>>>>
>>>> How can I make this application available at "http://www.mydomain.com"
>>>> without deploying it as ROOT.war?
>>>>
>>>> My server is running Ubuntu 10.04.
>>>>
>>>> Thanks!
>>>>
>>>> Dean Del Ponte
>>>>
>>>
>>> You could use a rewrite rule to achieve that:
>>>
>>> RewriteEngine On
>>> RewriteRule ^/$ /myApplication/ [PT]
>>> JkMount /myApplication* tomcat
>>>
>>> Works for me very well.
>>>
>>
>> That is assuming that the OP has an Apache httpd front-end, which he
>> never said.
>
> Ooops, he did...
Yes. ;-)
>
>> Also, even if he has, the above is not enough except in the simplest of
>> cases.
>> As far as I can tell also, this RewriteRule only rewrites requests to
>> "/".
>> If that is enough to make it work for you, then one could wonder why you
>> need an httpd front-end in the first place.
>> Note also that the JkMount above will not only proxy "/myApplication"
>> and "/myApplication/*", but just as well "/myApplication_as_a_prefix"
>> and anything else starting with "myApplication". This may or may not be
>> what you want, in terms of security for example.
That is a good point. I will change my configuration to
JkMount /myApplication/* tomcat
Thank you!
>>
>> Chuck's recommendation is still the best.
>> The above notes already illustrate some of the reasons.
>> Let's see if the OP really has a good reason /not to/ deploy his
>> application as ROOT.
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat 6 - How to make an application available at www.mydomain.com
Posted by André Warnier <aw...@ice-sa.com>.
André Warnier wrote:
> Thomas Rohde wrote:
>>> I'm running tomcat 6 behind apache.
>>>
>>> I currently have an application deployed as "myApplication" and it is
>>> available at "http://www.mydomain.com/myApplication".
>>>
>>> How can I make this application available at "http://www.mydomain.com"
>>> without deploying it as ROOT.war?
>>>
>>> My server is running Ubuntu 10.04.
>>>
>>> Thanks!
>>>
>>> Dean Del Ponte
>>>
>>
>> You could use a rewrite rule to achieve that:
>>
>> RewriteEngine On
>> RewriteRule ^/$ /myApplication/ [PT]
>> JkMount /myApplication* tomcat
>>
>> Works for me very well.
>>
>
> That is assuming that the OP has an Apache httpd front-end, which he
> never said.
Ooops, he did...
> Also, even if he has, the above is not enough except in the simplest of
> cases.
> As far as I can tell also, this RewriteRule only rewrites requests to "/".
> If that is enough to make it work for you, then one could wonder why you
> need an httpd front-end in the first place.
> Note also that the JkMount above will not only proxy "/myApplication"
> and "/myApplication/*", but just as well "/myApplication_as_a_prefix"
> and anything else starting with "myApplication". This may or may not be
> what you want, in terms of security for example.
>
> Chuck's recommendation is still the best.
> The above notes already illustrate some of the reasons.
> Let's see if the OP really has a good reason /not to/ deploy his
> application as ROOT.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat 6 - How to make an application available at www.mydomain.com
Posted by André Warnier <aw...@ice-sa.com>.
Thomas Rohde wrote:
>> I'm running tomcat 6 behind apache.
>>
>> I currently have an application deployed as "myApplication" and it is
>> available at "http://www.mydomain.com/myApplication".
>>
>> How can I make this application available at "http://www.mydomain.com"
>> without deploying it as ROOT.war?
>>
>> My server is running Ubuntu 10.04.
>>
>> Thanks!
>>
>> Dean Del Ponte
>>
>
> You could use a rewrite rule to achieve that:
>
> RewriteEngine On
> RewriteRule ^/$ /myApplication/ [PT]
> JkMount /myApplication* tomcat
>
> Works for me very well.
>
That is assuming that the OP has an Apache httpd front-end, which he never said.
Also, even if he has, the above is not enough except in the simplest of cases.
As far as I can tell also, this RewriteRule only rewrites requests to "/".
If that is enough to make it work for you, then one could wonder why you need an httpd
front-end in the first place.
Note also that the JkMount above will not only proxy "/myApplication" and
"/myApplication/*", but just as well "/myApplication_as_a_prefix" and anything else
starting with "myApplication". This may or may not be what you want, in terms of security
for example.
Chuck's recommendation is still the best.
The above notes already illustrate some of the reasons.
Let's see if the OP really has a good reason /not to/ deploy his application as ROOT.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org