Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

4 Answers

up vote 1 down vote accepted

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)

share|improve this answer
    
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 –  Alexandre Nizoux Mar 8 '10 at 10:32
add comment

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).

share|improve this answer
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.