Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a working development server with Apache, MySQL, PHP and Tomcat. I use virtual hosts for PHP websites (like admin.local and test.local) and I only have one .jsp webapp which runs on localhost:8080

Now I need to set up a production server with the same setup on another mac which has it's own static ip.

My problem is, I can't figure out how to make virtual hosts to work for Tomcat. I didn't install a connector (I've read something about that) so Apache doesn't know anything about Tomcat installation. Would connector help?

I've found a lot of articles on how to set up Tomcat on Mac, or how to use MAMP with Tomcat. But none address the issue of virtual hosts.

I've learned I can forward port 80 to Tomcat port so I see Tomcat app at http://localhost. But then how do I access the websites run by Apache?

I would appreciate any clue on the right direction.


share|improve this question
With an Apache VirtualHost, it must be bound to some interface (IP) and port.. I believe that each VirtualHost container for TomCat works the same way.. But you can only have one process attached to an interface & port. You CAN sort of cheat around that by using a reverse proxy, however. – Doc Jun 30 '11 at 22:09
Could you please elaborate on reverse proxy? – dfo Jun 30 '11 at 22:37
You could use a reverse proxy, like pound (, to bind to a single address & port. The reverse proxy is then configured with custom rules that tell it where to transparently redirect the traffic to. It acts a man-in-the-middle for connections. So you can host different services on ugly port numbers and provide them on normal port numbers. The service determines what goes where by hostname. You can also use reverse proxies for transparent load balancing. – Doc Jun 30 '11 at 22:40
I found quite a few similar questions on serverfault. They advice using nginx for reverse proxy – dfo Jul 1 '11 at 15:06
Personally, I use Apache for reverse proxying - as much as I suggested pound. I believe pound will function on a TCP level, though, whereas I think the proxy module in Apache is limited to http(s). Though I suppose it could work for others. Anyway, I don't find reverse proxying with Apache to be completely trivial. I haven't used nginx's rev proxy, but I bet it's pretty decent too. – Doc Jul 4 '11 at 15:06

You must log in to answer this question.

Browse other questions tagged .