Enable Gzip Compression in Apache

This is a simple sample configuration for the impatient. Compress only a few types AddOutputFilterByType DEFLATE text/html text/plain text/xml The following configuration, while resulting in more compressed content, is also much more complicated. Do not use this unless you fully understand all the configuration details. Compress everything except images <Location /> # Insert filter SetOutputFilter…

Allowing Apache to see client ip from Behind a trusted proxy.

With high speed caching based on nginx, varnish or CDNs in general the client ip gets lost. All IPs get reported as 127.0.0.1 since the proxy is making the socket request. Solution is two phased: 1) enable reporting the client IP to theĀ X-Forwarded-For header at the proxy or CDN. This depends on the proxy will…

Measuring Apache bandwidth from a bash script

So reason : double checking Sawmill and AWstats. (sawmill won..) echo “$(awk ‘{print $10}’ prd.logs | grep -v “-” | paste -sd + – | bc )/1024/1024/1024″ | bc result is in GB. nJoy;  

Using .htaccess to redirect a page with permanently moved 301

Though there are many ways to redirect using the HTTP 301 status code. (make sure the AllowOverride is set to all on the apache config) The .htaccess must be as follows: Options +FollowSymlinks RewriteEngine on rewritecond %{http_host} ^orig.domain.com [nc] rewriterule ^(.*)$ http://new.domain.com/ $1 [r=301,nc] Replace the orig.domain.com and new.domain.com with the ones needed for your…