skeletonz - The simple Python CMS system

Running Skeletonz behind Apache

Notice: Running Skeletonz behind Apache is optional.

This guide should work with both Apache 1.3.x and Apache 2.x. Requirements are that your Apache installation has following modules enabled:

  • mod_rewrite
  • mod_proxy

We will use a .htaccess file to configure Apache. From Wikipedia:
".htaccess (Hypertext Access) is the default name of Apache's directory-level configuration file. It provides the ability to customize configuration directives defined in the main configuration file. The configuration directives need to be in .htaccess context and the user needs appropriate permissions." Read more...

Step 1: Proxying requests from Apache to Skeletonz

Let's say your Skeletonz installation is running on localhost port 14003. You got your Apache installation running on localhost port 80. Your domain is and you would like to let Skeletonz handle (i.e. you illegal hamster porn page).

Your root .htaccess file (could be /var/www/.htaccess) should look like this:

RewriteEngine on
RewriteRule ^sexy_hamster(.*) http://localhost:14003$1 [P]

If you get a forbidden error from Apache then you got proxy problems... Try to tinker with Apache and read the Apache docs.

Step 2: Letting Apache serve static content

This is optional and only required if you want maximum performance. Currently this only works for Unix systems.

The thing we will be doing is creating /var/www/sexy_hamster and filling it with symbolic directory links.

First you must know where your Skeletonz installation is located. In this guide we will use following paths:

  • /users/bobo/sexy_hamster/H_Template/static/: The dir where static files of H_Template are located
  • /users/bobo/sexy_hamster/dynamic_dirs/: Where generated and uploads dirs are located
  • /users/bobo/sexy_hamster/skeletonz/static/: The dir where static_core is located

We will only let Apache handle some static directories, those are:

  • /sexy_hamster/static_tmpl -> /users/bobo/sexy_hamster/H_Template/static
  • /sexy_hamster/static_core -> /users/bobo/sexy_hamster/skeletonz/static
  • /sexy_hamster/generated -> /users/bobo/sexy_hamster/dynamic_dirs/generated
  • /sexy_hamster/uploads -> /users/bobo/sexy_hamster/dynamic_dirs/uploads

I.e. the URL should map to /users/bobo/sexy_hamster/H_Template/static.

Altering .htaccess again

We will disable some rewrites - this is because we want to disable Skeletonz serving those directories. Your new .htaccess file should look like this:

RewriteEngine on
RewriteRule ^sexy_hamster/generated/.* - [L]
RewriteRule ^sexy_hamster/uploads/.* - [L]
RewriteRule ^sexy_hamster/static_tmpl/.* - [L]
RewriteRule ^sexy_hamster/static_core/.* - [L]
RewriteRule ^sexy_hamster(.*) http://localhost:14003$1 [P]

Test this out by looking on your page - a lot of static files should be missing!

Creating symbolic links

First create sexy_hamster directory:

mkdir /var/www/sexy_hamster

Now we will fill /var/www/sexy_hamster up with symbolic links (remember that Apache is serving /var/www/sexy_hamster...)

It's crucial that the Apache option FollowSymLinks is turned on in /var/www!

We need to create a symbolic mapping for static_core:

ln -s /users/bobo/sexy_hamster/skeletonz/static /var/www/sexy_hamster/static_core

Next up is generated and uploads:

ln -s /users/bobo/sexy_hamster/dynamic_dirs/generated /var/www/sexy_hamster/generated
ln -s /users/bobo/sexy_hamster/dynamic_dirs/uploads /var/www/sexy_hamster/uploads

At last we have H_Template:

ln -s /users/bobo/sexy_hamster/H_Template/static /var/www/sexy_hamster/static_tmpl
Powered by Skeletonz