Category Archives: Uncategorized

SimpleSAMLphp and Apache2.4 with PHP-FPM

When trying to use SimpleSamlPHP in an Apache 2.4 environment with PHP-FPM, you might get the error

simplesamlphp ERR [bf585dbb39] SimpleSAML_Error_No
tFound: NOTFOUNDREASON('%' => 'https://test.domain.tld/simplesaml/module.php/core/fro
ntpage_welcome.php', '%' => 'No PATH_INFO to module.php')

After digging into this, it seems that it has to do with the fact that PATH_INFO is not used in in apache 2.4.11+’s mod_proxy_fcgi: see Apache mod_proxy_fcgi
where you can read:

When configured via ProxyPass or ProxyPassMatch, 
mod_proxy_fcgi will not set the PATH_INFO environment variable. 
This allows the backend FCGI server to correctly determine SCRIPT_NAME and Script-URI and be compliant with RFC 3875 section 3.3. 
If instead you need mod_proxy_fcgi to generate a "best guess" for PATH_INFO, set this env-var. 

This is a workaround for a bug in some FCGI implementations. 
This variable can be set to multiple values to tweak at how the best guess is chosen (In 2.4.11 and later only):

To make sure that simplesaml works, without breaking anything else that “fixes paths”, I configured mod_proxy_fcgi by creating a /etc/apache2/mods-enabled/proxy_fcgi.conf file containing:

<IfModule mod_proxy_fcgi.c>
  #No PATH_INFO with mod_proxy_fcgi unless this is set
  SetEnvIf Request_URI "simplesaml.*" proxy-fcgi-pathinfo=1


And afterwards re-enable the module + apache restart.

This fixes this problem.

Running multiple Redis instances on the same server.

Setting up multiple Redis instances on the same server is pretty easy, but if you want to be able to easily start/stop and restart instances, you’ll need to play with the init scripts of redis-server.

I needed this to be able to offer Redis buckets to different customers on a shared platform.

This is how I managed to set up multiple instances on the same server.
Since installing redis-server is out of the scope of this article, I’ll only explain what I did to manage multiple Redis Servers.

* Setting up a new INIT script:

* Paste this into the new redis-server init script:

Once that is done, we need to add multiple config files for our different buckets:

And enter some config settings looking like this:

Creating new instances is easily done by copying this initial conf file and adjusting the params (port, name, pid, savefilename, password,…)

Now, if you want to start/stop or restart all redis instances at the same time, this can be done with the normal service command:

The new init script we create above, will simply index all config instances from /etc/redis/servers and manage those 1 at a time.

Or, if you only want to manage 1 instance at a time, just do something like this for example:

which will restart only the instance running for website

Since we use this on a shared environment, we have a provisioning system in place, where our customers can change some settings

This article is based on: Robofirm: Setting up multiple redis instances, but I had to change some configuration to make it work. Anyway, a big thanks to Kirk Madera for pointing me in the right direction!

Automysqlbackup: Skipping the data of table mysql.event

When using automysqlbackup to dump your mysql databases, you might run into the following error:

While you can of course change the automysqlbackup script itself, to add the following line of code somewhere in the automysqlbackup script itself:

The option above is not upgrade proof, as your automysqlbackup script might get overwritten by the new version.

There is however an easier option to accomplisch this, and keep the settings:

Modify or Create your ~/.my.cnf and add the following lines of code to the mysqldump section:

Hope this helps!