java - How to run PHP and Tomcat on same server environment? -


asked on askubuntu while ago: https://askubuntu.com/questions/630897/apache-httpd-backed-by-both-tomcat-and-php no answers there decided ask here.

once again - let's have server accessible domain name e.g. http://mywebapp.com/

i setup following on server:

  • all requests http://mywebapp.com/blog* handled php server (wordpress blog engine specific)
  • all other requests http://mywebapp.com/* handled apache tomcat

i thought achievable putting apache httpd server in front of both tomcat , php servers couldn't find configurations achieve this.

could please provide hint on how achieve this?

you can mod_jk:

1) enable module "mod_jk" in apache web servers httpd.conf. uncomment line, removing leading hash:

loadmodule jk_module modules/mod_jk.so 

if on linux type:

sudo apt-get install libapache2-mod-jk sudo a2enmod jk 

2) edit [tomcat_dir]/conf/server.xml. add "jvmroute" attribute "engine" element:

<engine name="catalina" defaulthost="localhost" jvmroute="tomcat"> 

uncomment ajp connector (the http connector may disabled):

<connector port="8009" protocol="ajp/1.3" redirectport="8443" /> 

3) create file "workers.properties", next "httpd.conf". add content , set right ip/port:

worker.list=tomcat  worker.tomcat.type=ajp13 worker.tomcat.host=127.0.0.1 #this port ajp connector, not http! worker.tomcat.port=8009 worker.tomcat.lbfactor=10 

4) add mapping @ end of httpd.conf , replace [path_to_dir] absolute path:

<ifmodule jk_module>    jkworkersfile [path_to_dir]\workers.properties   jklogfile [path_to_dir]\mod_jk.log    jkloglevel info    jkoptions +forwardkeysize +forwarduricompat -forwarddirectories     setenvif request_uri "/error/*" no-jk   setenvif request_uri "/blog*"   no-jk    jkmount    /                    tomcat   jkmount    /*                   tomcat  </ifmodule> 

5) start tomcat , restart httpd.


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -