Asked this on AskUbuntu a while ago:
https://askubuntu.com/questions/630897/apache-httpd-backed-by-both-tomcat-and-php
but no answers there so I decided to ask here.
Once again – let’s say I have server accessible by some domain name e.g. http://mywebapp.com/
I would like to setup the following on that server:
- all requests like
http://mywebapp.com/blog*
are handled byPHP
server (WordPress blog engine to be specific) - all other requests
http://mywebapp.com/*
are handled byApache Tomcat
I thought that this could be achievable by putting Apache HTTPD
server in front of both Tomcat
and PHP
servers but couldn’t find configurations to achieve this.
Could someone please provide any hint on how to achieve this?
You can do that with mod_jk:
1) Enable module “mod_jk” in your Apache web servers httpd.conf. Uncomment this line, by removing the leading hash:
If you are on Linux type:
2) Edit [TOMCAT_DIR]/conf/server.xml. Add a “jvmRoute” attribute to the “engine” element:
Uncomment the AJP connector (the http connector may be disabled):
3) Create a file “workers.properties”, next to “httpd.conf”. Add this content and set right ip/port:
4) Add this mapping at the end of httpd.conf and replace [PATH_TO_DIR] by the absolute path:
5) Start Tomcat and restart Httpd.