anujin
anujin

Reputation: 781

How to set mod_proxy to serve some files while others to be served by apache

I have enabled mod proxy to serve my jsp and servlets and it seem to work fine. So if i hit localhost, it takes request to tomcat and executes it. What is want is that servlets and jsp are forwarded to tomcat while php is handled by apache. Both JSP/Servlets and PHP files are in the same folder and I need to make a call from JSP?Servlet to PHP or may be vice versa as well. Now the problem is that PHP is also forwarded to tomcat it seems if I use following pattern -

ProxyPass /auto http://serv.corp.com:8080/auto/

All JSP/Servlets and PHP files are inside auto folder which is in webapps folder.

Kindly help me to route static content i.e. PHP to apache.

Upvotes: -1

Views: 6783

Answers (2)

user1733951
user1733951

Reputation: 43

To server static content by Apache and remain files by appserver (jboss in my case)..

httpd.conf of Apache should look as:--

DocumentRoot   /usr/local/apache2/htdocs

ProxyPass   /   !

ProxyPass   /  https://www.example.com:8443/

ProxyPassReverse  /  https://www.example.com:8443/

here for example /logo.gif will be served directly by Apache from the /usr/local/apache2/htdocs/logo.gif file.

And everything else will be served by appserver.

Hope it will be useful

Upvotes: 2

Mark Thomas
Mark Thomas

Reputation: 16660

You want to use ProxyPassMatch rather than ProxyPass. Something like (untested)

ProxyPassMatch ^/(.*\.php)$ !

Upvotes: 0

Related Questions