Showing posts with label Apache. Show all posts
Showing posts with label Apache. Show all posts

Wednesday, August 6, 2008

Enable gzip compression on Apache web server in 3 easy steps

Make the following changes in apache/conf/httpd.conf :-

1) Uncomment "LoadModule deflate_module modules/mod_deflate.so"

2) Add "SetOutputFilter DEFLATE" inside <<IfModule mime_module> section

3) Add "AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript text/css" right after SetOutputFilter... line.

Restart Apache. You should see a significant improvement in the turnaround time for your web applications. This setting works for all responses tunneled trough Apache for ex:- for java web applications deployed on a Tomcat integrated with apache web server etc.

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.