Results 1 to 7 of 7
Hello,
I have a FC5 box, running apache 2 and tomcat.
I have a webapp located at /usr/local/tomcat/webapps/app
using the URL http://server.co.uk:8080/app the jsp and servlets all work fine.
I ...
- 11-08-2006 #1Just Joined!
- Join Date
- Nov 2006
- Posts
- 1
Apache / Tomcat / Mod_jk Help !
Hello,
I have a FC5 box, running apache 2 and tomcat.
I have a webapp located at /usr/local/tomcat/webapps/app
using the URL http://server.co.uk:8080/app the jsp and servlets all work fine.
I have a domain name abc.co.uk pointed at the server
its in apache httpd.conf and works ok.
But, to view the app, i have to use abc.co.uk/app
What i want is to be able to go to abc.co.uk and see the app
If i go to abc.co.uk i get the tomcat test start page
This is driving me crazy !!
http.conf:
<VirtualHost x.x.x.x>
ServerName www.abc.co.uk
DocumentRoot /usr/local/tomcat/webapps/app/
DirectoryIndex index.jsp
JKMount /* default
</VirtualHost>
Please, any help would be great
thanks you
- 03-06-2009 #2Just Joined!
- Join Date
- Mar 2009
- Posts
- 3
Bumping this old thread because I have exactly the same question. I'm trying to map subdomains to webapps deployed in Tomcat, e.g.
app1.example.org --> example.org:8080/app1
app2.example.org --> example.org:8080/app2
etc.
I've configured mod_jk in Apache and I'm able to map URLs under the subdomain to Tomcat, but I have not found a way to map URLs under one subdomain to one Tomcat context, URLs under another subdomain to another Tomcat context. Is this possible?
Many thanks
- 03-06-2009 #3Linux Guru
- Join Date
- Nov 2007
- Posts
- 1,695
Google "apache web redirect"
- 03-07-2009 #4Just Joined!
- Join Date
- Mar 2009
- Posts
- 3
Thanks, but an HTTP redirect isn't what I'm looking for. I want to map requests internally from Apache to Tomcat.
- 03-07-2009 #5Linux Guru
- Join Date
- Nov 2007
- Posts
- 1,695
This can be done via one of the many Apache redirect options (client or server side) and it can be done with a combination of DNS entries and iptables/redirection (those two I know will work.)
As for mod_jk, all of the options needed appear to be listed in the Tomcat mod-jk HowTo.
- 03-09-2009 #6Just Joined!
- Join Date
- Mar 2009
- Posts
- 3
Thanks for the suggestions, though I don't know what you had in mind re: "DNS entries and iptables/redirection". DNS records for all subdomains are of course pointing at the same server. There are only two ports in question: 80 for Apache (open) and 8080 for Tomcat (not open). I never found a straightforward way to get mod_jk to do what I need (hiding the context of each webapp in Tomcat), although apparently it can be done. In the end, mod_proxy provided a simple (if not the best in terms of performance) solution:
Code:NameVirtualHost *:80 <VirtualHost *:80> ServerName app1.example.org <Location /> ProxyPass http://127.0.0.1:8080/app1/ ProxyPassReverse http://127.0.0.1:8080/app1/ </Location> </VirtualHost> <VirtualHost *:80> ServerName app2.example.org ... </VirtualHost> ...
- 10-12-2009 #7Just Joined!
- Join Date
- Oct 2009
- Posts
- 1
You can also create two hosts on Tomcat side localhost:8080 (for app1)
and app2:8080 (for app2). Rename your applications to ROOT.war and do not include context element explicitly.
Now you can point mod_jk directly to root of those hosts and it work fine.
The only problem that I have with this setup is that I still need localhost:8080/app1 as local endpoint
maybe I will have to go back to localhost:8080/app1 and use the mod_proxy as you did...
Mike



