Your best option is to get a second IP for the server, set it up as an IP alias. The first IP is set on network interface eth0, the next one on eth0:0 (a third would be eth0:1, and so on).
Here's a general guide, but it might be easier to look for recent instructions for your Linux distro specifically:
http://www.cyberciti.biz/faq/linux-creating-or-adding-new-network-alias-to-a-network-card-nic/
Once you've done that, you set Apache up to bind to the first IP (as it is now) and Tomcat to bind to the new IP, e.g.
eth0 - 192.168.0.1 - Apache
eth0:0 - 192.168.0.2 - Tomcat
Then set your DNS up something like:
example.org - 192.168.0.1
tomcat.example.org - 192.168.0.2
No need to use :8080 at all, or any redirection/IP Tables forwarding. The links just point to http://tomcat.example.org/whatever/
Note that it is a new network interface, so you will want to check your IPTables rules and:
a) Close port 8080 on your first interface when you are no longer using it
b) Make sure you check / set IPTables to lock down the new IP address so only port 80 is allowed in.
You probably want to use ProxyPassMatch. You can use it like:
ProxyPassMatch ^(/.*\.cgi)$ ajp://localhost:8009$1
to proxy all requests ending in .CGI. If you wish to proxy multiple extensions just add more lines or edit the regex. Then you just have to make sure your VirtualHost is setup to serve the remaining image types.
Best Answer
If you're going with mod_jk, which is a popular option, Oscar's answer is correct. You need to limit what gets processed by Tomcat by changing something like this:
...to just the paths you'd like processed by Tomcat, e.g.:
If you're looking for additional options, mod_proxy_http or mod_proxy_ajp could also be used. I'll continue a couple quick examples for proxying *.jsp/*.cfm/*.cfc requests to Tomcat...
If you'd like to try both options, start by enabling both modules (and any dependencies), which is very simple with Ubuntu 10.04 ;-)
I like to add my proxy configuration in /etc/apache2/conf/httpd.conf on Ubuntu, but you could also place this in just one or more VirtualHost configs.
For any proxy to be allowed, assuming you're running Apache and Tomcat on the same server, you'll want to add a directive like this:
Here's a configuration using mod_proxy_ajp:
Obviously, the regular expressions can be tweaked to suit your needs (the above two ProxyPassMatch directives could even be combined into a single regex fairly easily).
To accomplish the same with mod_proxy_http, just change the protocol and port:
If you'd like to proxy specific hosts, and maybe mask a context path, you might prefer something like this within a specific VirtualHost:
Finally, if you need to get fancy (say, something odd like inspecting a query string or whatever else you can dream up with RewriteCond/RewriteRule), you could even leverage mod_rewrite with the proxy (P) flag to proxy to Tomcat. You'd need to enable one more module, mod_rewrite:
Then, within a VirtualHost, you can proxy CFML requests with:
As you can see, you can get quite creative :P Hope that helps!