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

share|improve this question
add comment

4 Answers

up vote 2 down vote accepted

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.

share|improve this answer
add comment

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

share|improve this answer
    
The php application will be Wordpress –  valmar May 26 '11 at 17:24
    
Looks like it's been done. Not sure what the current situation is though... YMMV –  HTTP500 May 27 '11 at 21:17
add comment

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.

share|improve this answer
    
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? –  valmar May 26 '11 at 17:26
    
I have two certificates (and two IP), installed in Apache, created with openssl, signed by Thawte/Godaddy –  leonbloy May 26 '11 at 17:30
add comment

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.

share|improve this answer
    
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? –  valmar May 26 '11 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/… –  Hax May 27 '11 at 14:08
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.