Two different languages PHP and Java on same application with PHP on Apache and Java on Tomcat

谁都会走 提交于 2019-12-03 09:05:53

The two applications served via apache should not be a problem look at mod_jk This will mean your java web app is still running on tomcat which it has to do anyway.

Maybe this tutorial will help. Though I haven't tried it myself so I can't say for sure.

I am able to get Apache talk to Tomcat through mod_proxy. I actually referred to the below links to get this working (mostly changes to httpd.conf in Apache and server.xml in Tomcat):

http://tomcat.apache.org/tomcat-5.5-doc/proxy-howto.html http://confluence.atlassian.com/display/DOC/Using+Apache+with+mod_proxy http://publib.boulder.ibm.com/infocenter/cqhelp/v7r0m0/index.jsp?topic=/com.ibm.rational.clearquest.webadmin.doc/rwp/t_config_mod_proxy_support.htm

I then configured PHP with Apache following [this link][1] and got the PHP configured with Apache.

So as a test program, I am able to reach servlet programs (Tomcat) from a Apache like http://localhost/example/servlet then access PHP programs too with a URL like http://localhost/phptest

ZeissS, Paul and Vincent. Thanks all for your help. Even though I have a long way to go, this looks like the starting point.

=== httpd.conf in Apache server ===

# enable the below or add new
LoadModule proxy_module modules/mod_proxy.so

LoadModule proxy_http_module modules/mod_proxy_http.so

# Start Modules for PHP
LoadModule php5_module "c:/php/php5apache2_2.dll"

AddHandler application/x-httpd-php .php

# configure the path to php.ini
PHPIniDir "c:/windows"

# Just at the end of 'Main' server configuration - add the below
ProxyRequests On 
ProxyVia On 
<Proxy *>
    Order deny,allow
    Allow from all
</Proxy>

ProxyPass /examples http://localhost:8080/examples/
ProxyPass /servlets http://localhost:8080/examples/servlets/
ProxyPass /jsp http://localhost:8080/examples/jsp/
ProxyPassReverse /examples http://localhost:8080/examples/

# Finish Modules for PHP

=== server.xml in Tomcat ===
<!-- searched the below connector port=8080 and I replaced that tag with the below -->
 <Connector port="8080" maxHttpHeaderSize="8192"
           maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
           enableLookups="false" redirectPort="8443" acceptCount="100"
           connectionTimeout="20000" disableUploadTimeout="true"
           proxyName="http://localhost" proxyPort="80"/>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!