How To: Compress web page data transfer with mod_deflate and mod_headers

Since I rebuilt my VPS the other day there a number of tweaks and changes I need to make which can speed up the website – one of the easiest ones with the biggest effect on pageload time is to have apache serve compressed versions of pages to users. Here’s how to do it, and test that it’s working.

Enabling mod_deflate and mod_headers

Chances are good that you already have mod_deflate and mod_header on your server (they typically come with the apache install) – so all you need to do is enable them. To do so, open your main apache config (for example, on mine it’s /etc/httpd/conf/httpd.conf and uncomment the LoadModule lines for each module, so that they end up like this:

With that done, you can head down to the bottom of the config file and add the following section to enable compression of all html, css, js, xml and such.

Restarting apache and testing it out

With those changes made, save the file, restart apache (for example, via: sudo systemctl restart httpd.service if you’re on a systemd-using machine), and then go to: http://www.whatsmyip.org/http-compression-test/

Plug in your URL and hit submit, and you should see some good news similar to this:

A page saying that we are successfully serving compressed webpages.

Very nice =D

Many thanks to: brighterlamp.com for the original article this one is based on.

How To: Extract .ace Archives in Linux

The .ace compression format is rather legacy, but you still find the occasional old file compressed in it, and p7zip-full won’t extract ’em. There’s a package in Ubuntu 10.04 called unace, and you’d expect this to do the job – only it doesn’t. It’s version 1.2 which is absolutely legacy…. I mean seriously, it’s archaic – and it won’t extract “modern” .ace files.

So, to get this all sorted, just head on over to Softpedia and grab unace v2.5 (which itself was built in 2003!), extract the tar.gz, and then either use the unace binary from where it is or sling it in your /usr/bin/ directory for convenience.

Unace v2.5 on Linux

Decompression achieved.

Prince Rupert’s Drops

Prince Rupert’s Drops are just molten glass dropped into a bucket of ice water, where they form tadpole like shapes. Nothing too exciting so far…

But, as they cool so rapidly, the external area in contact with the icy water goes under super-high compression, which makes ’em tough. And what happens when you break that tension? Find out!

There’s a video showing the fun part in more detail here.

Thank you, StumbleUpon! =D

How To: Compress Each Folder/Directory to Separate Archives in Linux

Lets say you’ve got a bunch of folders taking up a large swathe of space which you never really use but want to keep, just not taking up stacks of your NAS… How can you easily compress them all up to individual archives of each folder? Dead easy:

Save that to a file, chmod +x it and run in the location you want to compress the folders. Every folder (and all contents within) will be compressed to its own foldername.7z archive.

With 7z, -mx9 is the flag for maximum compression, and -mmt says to use multiple CPUs to speed up compression, so omit that part if you’re on a single core machine.

2016 Now-That-I-Think-Of-It Update

The way I use this script is by simply putting it into a file called zipeach, making it executable, and then moving it to /usr/local/bin – which makes it convenient to be able to compress all folders in your pwd at whim.

Also, in case it’s important to you, the 7z format does not maintain file permissions, so if you need to preserve file permissions then you’ll likely want to compress each folder into a .tar archive, and then compress that into a .tar.7z.