About this blog…

I am employed by Netnod as head of engineering, research and development and am among other things chair of the Security and Stability Advisory Committee at ICANN. You can find CV and photos of me at this page.

As I wear so many hats, I find it being necessary to somewhere express my personal view on things. This is the location where that happens. Postings on this blog, or at Facebook, Twitter etc, falls under this policy.

The views expressed on this post are mine and do not necessarily reflect the views of Netnod or any other of the organisations I have connections to.

ServerAdmin and manual editing of Apache Config

I had an example of problems with ServerAdmin yesterday. I have one server (using Django) needing special settings for the Python environment. I have added that manually via two LocationMatch statements in the Apache Config for the site in question. Remember (or note) that the order of those LocationMatch statements do matter for Apache.

One of them was more specific than the other one, and the specific statement was this:

<Location "/">
   PythonHandler django.core.handlers.modpython
   SetHandler python-program
   SetEnv DJANGO_SETTINGS_MODULE admin.settings
   PythonPath "['/usr/local/www/example.com/django'] + sys.path"
   PythonDebug On

The other one was:

<LocationMatch "^/(robots.txt|favicon.ico|images|css|js|media)(/|$)">
   SetHandler None

As readers familiar with Apache and the LocationMatch statement, the order is important, and of course the order is exactly the order I here have displayed the two statements.

I wanted to have a version of this website using SSL, on a different port, so, being happy with the configuration, I cloned it using ServerAdmin.

Everything went well except that the order of the LocationMatch statements changed. I.e. ServerAdmin did not touch the old website, but the new one had the LocationMatch statements in reverse order, although I just did duplicate in ServerAdmin. Which of course made the new site not work. An hour later (I should have understood this faster) I had manually corrected the errors ServerAdmin did.

So, a recommendation: before you change any of your sites, or add a new one, copy all of the site descriptions to a separate library so you can absolutely restore to what the situation was before you started changing things manually.

Comments are closed.