Using RewriteMap and DBM files for mass Apache redirects

Its not that unusual to need a large number of redirects in Apache, and even if you’ve been following best practice and keep sites in separate vhost files, a couple of rounds of redirects can leave your files bloated, messy and just that little bit more difficult to maintain.

The Apache RewriteMap directive allows you to create a ‘function’ which can then be called in RewriteCond and RewriteRule rules. Basically it means you don’t need to explicitly state each rule in your vhost files.

It works by allowing you to specify an external map once in your file using the following syntax:
RewriteMap mapname maptype:maplocation
mapname – being the the name you’ve given to your external mapfile [Read more…]

Compiling subversion 1.7.1 from source with SSL


If you need to install Subversion 1.7.1 to a server with SSL support, here’s a quick routine to get that done.

Download the latest version
cd /usr/local/src
wget http://apache.mirror.aussiehq.net.au/subversion/subversion-1.7.1.tar.gz
tar -zxvf subversion-1.7.1.tar.gz
cd subversion-1.7.1

Use the in-built script to download the required dependencies, and configure neon for SSL
./get-deps.sh
cd /neon/
./configure --with-ssl
make
make install
cd ..

Download and install the required sqlite3.c
wget http://www.sqlite.org/sqlite-amalgamation-3.7.0.1.tar.gz
tar xvzf sqlite-amalgamation-3.7.0.1.tar.gz
mkdir /sqlite-amalgamation/
cp sqlite-3.7.0.1/sqlite3.c /usr/local/src/subversion-1.7.1/sqlite-amalgamation/

Configure & make Subversion
./configure --with-neon=/usr/lib64/
make
make install

if you’ve used default install locations, add to path
export PATH=$PATH:/usr/local/bin

How to configure a MySQL cronjob backup without exposing your password

Create a .my.cnf file in the home directory, (note the leading ‘.’ this hides the file)
nano ~/.my.cnf

Add the following section to your file:
[mysqldump]
user = mysqluser
password = yourpassword

change the file permission to 600 to secure the cnf file.
chmod 600 ~/.my.cnf

configure your cronjob as normal, note that you do not need to pass the -p switch as crond will read in your .my.cnf
crontab -e
0 30 * * * mysqldump databasename -u mysqluser > pathtofile.sql

thats it nice and simple

Further crontab syntax info can be found here