This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Tomcat and the fly likes Using the same port on Apache and Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Using the same port on Apache and Tomcat" Watch "Using the same port on Apache and Tomcat" New topic
Author

Using the same port on Apache and Tomcat

Adrian Marthaler
Greenhorn

Joined: Nov 18, 2008
Posts: 1
Hey there
I am using the newest Apache (2.2.10) and the newest Tomcat (6.0.18) on a Windows 2003 server. My question now is, if it is possible to have the Tomcat and the Apache running on the same Port (e.g. 80)? I already found a tutorial explaining about how it could be done, but it is for a much older version of Tomcat and Apache (http://www.dynamicobjects.com/d2r/archives/002574.html). Does it still work the same way, or do I have to do something differently?
Thanks already in advance!

Mantz
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8839
    
    7

As far as I know, it cannot be done. Servers require exclusive access to the port they bind to.
What you see in the tutorial you linked is setting up the Tomcat connector in both Apache and Tomcat. Apache is running on port 80 (the URL the tutorial is http://localhost/test.jsp). That request gets passed to the connector, then to Tomcat listening on 8009.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41137
    
  45
Welcome to JavaRanch.

The up-to-date instructions on how to make Apache httpd and Tomcat play nice can be found at http://tomcat.apache.org/connectors-doc/ and http://tomcat.apache.org/connectors-doc/webserver_howto/apache.html

While technically both servers aren't listening to the same port (for the reason Joe mentioned), from the outside it looks like they do. So if httpd runs on port 80, then the user will never see a port number, whether the content comes from httpd or Tomcat.


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using the same port on Apache and Tomcat
 
Similar Threads
Can't access Tomcat 7 from network
Apache Not able to get html files & GIF files placed in the Tomcat
Unable to run JSP
Basic Tomcat Question: Change Port 8080?
Question about integrating apache and tomcat 4