Getting /Server-Status to work with Amazon ElasticBeanstalk + CodeIgniter

December 13, 2013 by Andrew Seymour

I was trying to get the /server-status for my CI site running on ElasticBeanstalk (while I realise this isn’t particularly helpful for a load balanced system as you’d only get it for the server making the request, it isn’t getting a lot of traffic at the moment and i’m sure it wouldn’t be too difficult to tap into the API and query the other servers too) but faced some odd 404 and 403 issues.

First thing to remember is that you need to include it in your rule .htaccess rewrite rule condition which is where your 404 and/or 403 errors are coming from;

RewriteCond $1 !^(index\.php|robots\.txt|server-status)

This will work if you’re querying via file_get_contents or cURL but, if you want to do it via exec() doing

apachectl status

Then you’ll need to make sure you have the following in your .ebextensions/file.config configuration;

packages:
  yum:
    elinks: []

Which will install elinks required for the apachectl bash script. And that’s it, 2 different ways for getting the current Apache /server-status via ElasticBeanstalk (with the AMI I was using from them, mod_status was already enabled and configured globally to only allow from the local machine).


Categories: Cloud, PHP, Servers, Software

Tags: apache, apache2, codeigniter, mod_status, php, server-status