Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how do I install 2 web servers on same box using same IP address?

 
Benjamin Weaver
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,

Thanks in advance.

I do it by assigning to each server a unique port number, no? If I am correct, what do I need to do to make the 2nd port number ping-able and web-accessible?

We have been running Apache; we want to install a second web-server independently on the same box: Tomcat. Apache runs fine on port 80. We configured Tomcat with 8080 in the config file (server.xml I think). Tomcat does not run correctly with 8080. However, in a test performed while the Apache was shut down, Tomcat ran fine using 80. Nor, for that matter, does our Apache run on 8080. Therefore Port 8080 seems to be the problem.

If I am correct that different web servers are differentiated by unique port numbers on the same box, what do I need to do to enable port 8080 (or any other port for that matter)?

(1) add an entry to the DNS?

(2) assign rights enabling the port to be accessible through the firewall?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65105
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you specifying :8080 on the URL? Without it, port 80 is assumed.
 
Benjamin Weaver
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I have tried to access our site using url:8080: http://163.1.169.41:8080. No luck so far
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65105
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm, you're probably going to have to give you more details of your setup. I have no difficulties runing Apache on port 80 and Tomcat on 8080 on Mac OS X.

Are you trying to access from the same machine? Or only on the other side of a proxy or firewall?
 
Benjamin Weaver
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear, thanks for your help on this.

1. We tested the Tomcat on my own machine using http://localhost:8080
It worked.

2. We then ported the Tomcat to our development server, which lies behind a firewall from my machine. Attempts from my machine to hit our dev server url, http://163.1.169.41:8080, failed. Similar attempts to hit the Tomcat on dev server port 80 (after Apache which normally runs on port 80 had been shut down) succeeded.
 
diana_brit
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
You need to open the firewall outgoing port 8080 for outgoing, that will make the firewall to allow the sites to open using the port 8080.
 
Benjamin Weaver
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Diana. This is what I have been suspecting.

Thanks to both of you. Any other input is welcome. An administrator has asked,

"If you're coming through a router - which you probably are [maybe more than one], is port 8080 forwarded to the webserver's IP?"

I did not know the answer to this. I do know that the only thing we have done is to modify httpd.conf for Apache and server.xml for Tomcat.

We have done nothing else.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you trying to run them independently or are you trying to connect them?
 
Benjamin Weaver
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For the time being, we are trying to run each independently, for various practical reasons.
 
Guy Allard
Ranch Hand
Posts: 776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should talk to the folks who set up the firewall(s).

Try the 'traceroute' utility to see what is happening with differnt ports (utility named differently depending on your OS).

I think you have a wall dropping packets on the floor (i.e. port is blocked).

G.
 
Benjamin Weaver
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you all for your help on this. My solution--at least for the time being--was a workaround: I setup the Apache as a proxy server, which would forward calls to my application on Tomcat. It seems like pretty standard web configuration technique, but I had never set it up before.

I thought I might include the information in case anyone might find it useful.


To set up this kind of Apache/Tomcat configuration, I consulted the following link:

http://tomcat.apache.org/tomcat-5.0-doc/proxy-howto.html

In short, you modify Apache's httpd.conf file with instructions to forward calls to [apacheURL]/myTomcatWebApp, and on the Tomcat side, you modify server.xml by including a proxyPort attribute.

Thus:

In Apache httpd.conf:
...
LoadModule proxy_module modules/mod_proxy.so

...

ProxyPass /servlets-examples http://163.1.169.41:8081/servlets-examples
ProxyPassReverse /servlets-examples http://163.1.169.41:8081/servlets-examples
...



in Tomcat server.xml:
...
<Connector port="8081"
proxyPort="80"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
debug="0" connectionTimeout="20000"
disableUploadTimeout="true" />
...


one caveat: if you are using Apache 2.0 you need only add a LoadModule instruction for the proxy module. You MUST not insert an additional AddModule line. The docs say that for Apache 2.0 you MAY omit the AddModule instruction, but I found that you MUST omit it, or the configuraiton won't work.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic