Sunday, April 6, 2014

Using apache with mod_proxy module.

Steps :

1) setup connector in server.xml file of tomcat.

<Connector port="9090" maxHttpHeaderSize="8192"
           maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
           enableLookups="false" redirectPort="8443" acceptCount="100"
           connectionTimeout="20000" disableUploadTimeout="true"/>
 
path to locate file : apache-tomcat\conf\server.xml
 
 
2) put any war into webapps folder of tomcat
   eg. myApp.war
 
3) open httpd.conf file (path = C:\Apache24\conf\httpd.conf)from your apache24 folder and paste the following contents : 
 
<Proxy *>
    Order deny,allow
    Allow from all
</Proxy>

ProxyPass         /myapp  http://localhost:9090/myapp
ProxyPassReverse  /myapp  http://localhost:9090/myapp
 
 

4) start the tomcat. Make sure that you have closed the port 9090 by using nmap tool.
or 
just try accessing you app through:
localhost:9090/myapp
 
5) start apache tomcat.
 
6) Access your app by hitting:
   localhost/myapp

This will only work with http protocal. Wait for my next post to getting it working on port htpps as well.

Bye. Take Care!!

 

No comments:

Post a Comment