1

I have one Java- and one PHP-application which I both want to run on the same machine (using Tomcat).

As far as I can see, I have two options:

  • Option 1: Do the classic apache-tomcat setup with mod_jk and let apache handle the php requests and forward all requests to the Java application to tomcat.
  • Option 2: Use only tomcat by installing php on it. So, no extra apache server for handling php.

I don't have much experience with this, so I wondered which option would be the wise one, since I cannot foresee which problems might occur.

I, personally, prefer option 2 because I'd then have to manage just one server instead of two. However, I have a bad feeling about this since most people out there seem to prefer option 1.

Which option should I pick?

Important: I need SSL support available for both (php and java) applications. As far as I know, creating the CSR file for buying a SSL certificate differs between apache and tomcat (openssl vs. keytool). Since I don't want to purchase two certificates, this has to be kept in mind.

1
  • why not nginx proxy(terminate ssl here) to apache and tomcat? this allows you to scale, when needed. Commented Jan 28, 2015 at 19:26

4 Answers 4

2

If it were me I would do option 1. The Apache->Tomcat scenario is well documented and well tested. It is also recommended for sites with any amount of static content. PHP under Tomcat is a less commonly implemented. I suspect that it isn't as mature or as well documented.

1

Option 3 (a somewhat esoteric option) is to run Quercus which provides a PHP implementation in Java. Depends upon your PHP application I guess whether this is viable.

Cheers

2
  • The php application will be Wordpress Commented May 26, 2011 at 17:24
  • Looks like it's been done. Not sure what the current situation is though... YMMV Commented May 27, 2011 at 21:17
0

Option 1 is fairly simple and flexible, specially in Linux. In addition you can also connect Apache to Tomcat via mod_proxy (as an alternative to mod_jk). I've been using this setup (with ssl, and several virtual sites) for a while, works nice.

2
  • Do you use only one SSL certificate? If yes, did you create it using openssl or keytool? And did you install it on apache or tomcat? Commented May 26, 2011 at 17:26
  • I have two certificates (and two IP), installed in Apache, created with openssl, signed by Thawte/Godaddy Commented May 26, 2011 at 17:30
0

I think option 1 is more efficient overall, especially for the PHP side?

I vote for 1. Also there must be a way to use one certificate.

2
  • Could it be enough to install the certificate on the apache server and tell it to secure all data, which would be tunneled to tomcat, through ssl? Commented May 26, 2011 at 17:28
  • That sounds right. For two servers it should be ok, but gets more riskier if using same cert for more servers. Also maybe seen already: verisign.com/ssl/ssl-information-center/ssl-basics/… Commented May 27, 2011 at 14:08

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.