AWStats - poor man's download counter

Condescending WonkaA few days ago I was asked to configure AWStats to count downloads of .exe files on an website. I know that it's blindingly obvious that AWStats isn't the right tool for this job, but sometimes you have to pick battles with your clients. To save both my time and sanity I did what I was asked to do.

Interestingly, adding file download tracking functionality to AWStats proved to be very easy. In my case, the website was hosted on a cPanel server where AWStats was already installed, so I won't cover the whole installation procedure.


Change passwords for multiple cPanel accounts (bulk password reset)

Geeks and repetitive tasksThe other day I needed to change passwords for multiple cPanel accounts. Since there was a lot accounts in question, changing passwords manually was out of the question. Changing passwords from shell using passwd utility was also out of the question because that would change only the password for Unix user - MySQL and FTP passwords would remain unchanged. In the end I wrote a simple script which automates changing system, FTP and MySQL passwords for cPanel user.


Adding custom modules to Nginx RPM

Skeptical babyIf you've installed Nginx from source, adding custom modules is easy. You simply recompile Nginx and include the module you want. But what if you've installed Nginx from RPM? How do you install custom module in this case? Well, you'll need to repackage RPM and although it may sound really complicated, it's not that big of a deal.

In this example, I'll explain how to include Frickle's Nginx slow cache module for caching static files. This module is excellent if your static files are stored on a slow filesystem (e.g. NFS storage, slow HDD's). To speed things up, Nginx can fetch these files once, and then cache them on a faster filesystem (e.g. local SAS/SSD). This way, Nginx will serve the files much faster and you'll minimize the network traffic.


Nginx maintenance page with 503 HTTP status code

Conspiracy KeanuThe other day I had to do some maintenance on a server with Nginx configured as a reverse proxy for Apache. The configuration was very simple - Nginx was in front of Apache and it served static content. Apache in the back was responsible for PHP stuff.

During the maintenance period, I wanted to redirect all requests to a custom maintenance page. Also, to avoid search engines indexing my maintenance page, I wanted that maintenance page returns proper HTTP status code - i.e. 503 service unavailable.


Etherpad Lite up 'n' running in 5 minutes

Forever aloneEtherpad Lite is a lightweight version of (probably) the most popular web-based collaborative real-time editor - Etherpad. This great peace of software allows multiple users to edit the same document in real-time. To make collaboration easier, users have built-in chat at their disposal. History playback, infinite undo, easy import and export of documents are some of the cool stuff it has to offer.

Compared to the original, EL has very short system requirements list, which makes it very easy to deploy. Since it's written in server-side JavaScript using Node.js, to make it functional for testing/development purposes you'll need only Node.js, but for everyday/production usage it's recommended that you use a web server (e.g. Apache or Nginx) and MySQL.