Tunnel UNIX-socket with SSH or HAProxy

Forward PHP-application's MySQL-connections towards localhost to a remote server, edit ~/.ssh/config:

Host my-remote-database-server
    LocalForward /var/run/mysqld/mysqld.sock 127.0.0.1:3306

Do the same, with HAProxy:

global
    log /dev/log local0 notice
    user haproxy
    group haproxy
    stats socket /var/run/haproxy.stat level admin

defaults
    log …
more ...

Send system cronjob output via XMPP

This is useful if you either lack a complete e-mail infrastructure for your server, or if you don't need a full-fledged e-mail server setup with domain names and all that.

I personally use it to get the information as fast as possible, rather than wait for the next polling of …

more ...

How to host Etherpad

This is what Wikipedia says about it

Etherpad is an open source, web-based collaborative real-time editor, allowing authors to simultaneously edit a text document, and see all of the participants' edits in real-time, with the ability to display each author's text in their own color.

The good things:

  • Self-hosted
  • Open …
more ...

Mail on SSH-login

First we need a way to send an e-mail. This package provides the "mail" command.

apt-get install mailutils

As root, create the file /etc/ssh/sshrc with the following content:

exec 1>&2
env | mail -s "LOGIN $USER@$(hostname) from ${SSH_CONNECTION%% *}" root

From now on the user "root" will receive …

more ...

Accelerating Wordpress with Varnish

The receiver part:

sub vcl_recv {
  # Wordpress - cache everything except...
  if (!(req.url ~ "wp-admin|xmlrpc\.php|wp-(comments-post|login|activate|mail)\.php|&preview=true")) {
    unset req.http.cookie;
    return (hash);
  }

  # Happens before we check if we have this in cache already.
  # 
  # Typically you clean up the request here, removing cookies you …
more ...

Automatic upgrades in Debian

First we install the required packages. As root do:

apt-get install unattended-upgrades

Create the file: /etc/apt/apt.conf.d/20auto-upgrades and add the following content to it:

APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";

Replace the file /etc/apt/apt.conf.d/50unattended-upgrades and add the following to …

more ...