1

I would like to host both Tomcat and PHP on port 80 on Linux and I have 2 IP addresses available.

I am only using PHP so that I can host some mailing list software, I can map it to newsletter.mydomain.com. So my question is, is it possible to run Tomcat on port 80 on 1 IP address and Apache on port 80 on another IP address?

4 Answers 4

1

Easily use one IP with port 80 for Apache: Make sure your configuration has Listen your.first.ip.addr:80 (ex Listen 92.12.0.2:80) and not just Listen 80 (since that would listen to ALL the IP addresses of the box on port 80).

For Tomcat, make sure to configure your connector with the parameters port="80" address="your.second.ip.addr".

You'll easily be able to run both apps on the same box using each IP on port 80.

Good luck.

(More on Tomcat: http://tomcat.apache.org/tomcat-6.0-doc/config/http.html, more on Apache: http://httpd.apache.org/docs/2.0/bind.html)

1
  • Of course both IP addresses won't be able to answer for the same qualified hostname, you'll have to have 2 separate hostnames, each attributed to one IP. ie: apache.domain.com and tomcat.domain.com Mar 8, 2010 at 10:32
4

You could use Apache for PHP and forwarding request to Tomcat with mod_proxy_ajp. Tomcat should then be listening for AJP on any other port than 80 (8009 should be the default).

1

You need something on port 80 that can forward requests to Tomcat (and maybe even to whatever you use to serve PHP). For example Apache can work as a reverse proxy. And nginx. And varnish was made for the exact purpose.

-1

You could also just bind Tomcat to port 80 on one IP, and your PHP web server (apache?) to port 80 on the other IP.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .