Showing posts with label Tomcat. Show all posts
Showing posts with label Tomcat. Show all posts

Thursday, May 21, 2009

Enable security in Tomcat

I finally figured a way to enable Security Manager on Tomcat 6.0 (windows) . The documentation at Apache Tomcat's official website is incorrect and, needs revision.

Please follow these steps to enable security on your Tomcat server:-
1) Right click on the tomcat monitor icon

2) Open the Configure dialog.
3) Click on the Java tab

4) Add 2 system properties - java.security.manager and java.security.policy that points to the policy file. I'm pointing to the default catalina.policy file that ships with tomcat distribution.

5) Add the 2 properties to java options
6) Click OK.
7) Stop Service
8) Start Service
9) Tomcat is now running with security enabled.

Thanks for reading this post. Please leave comments/suggestions to let me know if it worked for you.

Tuesday, June 10, 2008

Integrate Apache Web Server 2.x with Tomcat 6.x on Windows XP

1) Enable Apache's HTTP proxy module by uncommenting the following lines in {APACHE_DIR}/conf/httpd.conf

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so

2) Right at the end of the Load module section in httpd.conf, register URLs that should be forwarded to Tomcat like this:-
ProxyPass relative_url translated_url

For ex, Accessing a web application named 'tp' deployed on a local Tomcat server listening on port 8080 through Apache's http proxy (http://localhost/tp) would like this:-
ProxyPass /tp http://localhost:8080/tp

3) Add Apache's proxy to Tomcat's <connector> element associated with port 8080 in {TOMCAT_DIR}/conf/server.xml by adding the proxy attributes like this:-
<connector port="8080" protocol="HTTP/1.1"
connectiontimeout="20000"
redirectport="8443"
proxyName="localhost"

proxyPort="80"/>

That's all there is to it. You should now be able to access tomcat via Apache Web Server's HTTP reverse proxy.