4
Feb

Dynamic HAProxy backends

Bill Lumbergh - Office SpaceHAProxy is one of very few pieces of software that are truly a joy to use. It's written in C, it's reliable, fast, secure and versatile.

I've been using it for a number of years now for all kinds of purposes and its ability to inspect and manipulate HTTP requests is one of the features I use most often.

In this tutorial, I won't explain how to install and configure HAProxy, but rather how to use HAProxy for load balancing or simply redirecting HTTP traffic to desired backends by matching specific cookies or request headers. The cherry on the top will be dynamic HAProxy backends defined in map files, for easier automation and cleaner configuration file.

1
Sep

Rebuilding software RAID without mdadm.conf

Austing PowersRebuilding software RAID array is very easy when you have your mdadm.conf file at hand, but when you find yourself in a situation without backup of that little config file, e.g. after reinstalling the system or when your migrate disks to the new server, it can be a bit daunting.

Recently I had to reassemble two software RAID1 arrays one small Debian server after OS reinstall. So, there were four hard drives in total and to avoid mix-up and data loss, I had to find out which disk belonged which RAID array. Examining each drive with mdamd provided me with the necessary information.

 

 

3
Dec

How to remove VirtFS like a boss

Like a bossRecently I was unfortunate to witness huge filesystem loop on a cPanel server that was caused by combination of VirtFS and Idera's Server Backup software (previously known as R1soft CDP backup). To cut the chase, I had to disable and remove VirtFS for all users on the server. cPanel has documented how to do this on their wiki, but they failed to mention couple of very important things that will help you not to destroy your server.

So, cPanel provided us with nice little script that can unmount orphaned VirtFS mounts. The script is located at /scripts/clear_orphaned_virtfs_mounts and you can get to know it better if you run it with --help switch. Running the script with no arguments will simply unmount obsolete VirtFS mounts (e.g. for terminated account), but if you have to remove VirtFS for an account that is still active, you will have to take a different approach.

19
Jan

Fixing timeout between Nginx and PHP-FPM

SysadminIn case you've set up Nginx as reverse proxy for PHP-FPM and you have very slow or complex PHP script that executes for quite some time, you've probably seen an 504 gateway time-out error. This is pretty common error, but in most cases people are barking at the wrong tree and they're having difficulties finding out which timeout directive is the right one for their scenario.

I've seen some people desperately experimenting with proxy_read_timeout, send_timeout, even client_header_timeout and client_body_timeout directives, but if they bothered to take a peek into Nginx's error_log, they would've seen an error such as:

15
Oct

Exim ACL for blocking certain senders

This is definitely not spamIf you're in a need for fast and simple solution to block certain senders directly on Exim mail server, you're in luck. Couple of weeks back I needed to blacklist a spammer on a relay mail server, so that I could take my time and carefully trace the origin server/script from where the spam was being sent.

Implementing sender blocklist is very simple. Just open Exim's configuration file - if you're using CentOS or RHEL, look no further than /etc/exim/exim.conf. On Debian based distributions Exim's configuration is split into multiple files, so the recommended way of reconfiguring Exim is with dpkg-reconfigure exim4-config.

Pages