Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

Thanks!

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 (apsis.ch/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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.