1 (edited by cezio 2010-10-31 20:54)

Topic: Punbb + Cherokee (walkthrought, a sort of)

Hi

I've set up PunBB with Cherokee web server (http://www.cherokee-project.com/) recently. The set-up was not trivial, because punbb was supposed to be served from a subdir (/forum) with fancy urls enabled. Root (/) path was served by other application. This required some extra magic and small change in rewrite.php to get fancy urls working.

I'm posting this, because I couldn't find any tutorial about it on the web, and I've went thru quite deep debugging session, to get it working. Besides of that, maybe you would be able to find easier, better, prettier way to do this.

First of all, in scenario without fancy urls, it will work almost OOTB. This requires just 4 rules defined in cherokee. I assume, that $pbb is a absolute path to your PunBB installation. Rule order is important here:

  • Directory rule for /forum/img/ and serving static files from your $pbb/img

  • Directory rule for /forum/style and serving static files from your $pbb/style

  • Path rule for /forum/ path and redirection to /forum/index.php

  • Directory rule for /forum and serving FastCGI application from your $pbb dir

Scenario with fancy urls enabled requires 2 more rules after /forum/style rule:

  • Compound rule ((NOT File exists) AND Directory /forum/) which will redirect internally to /rewrite.php

  • Path rule for /rewrite.php and FastCGI application served from your $pbb dir

Also, you linking your $pbb dir to /forum subdir in your document root will save you a lot of time of scratching your head.

Additionally, you should put

define('FORUM_URL_BASE', '/forum');

line into your config.php and add

// remove defined prefix from request uri
if (defined('FORUM_URL_BASE')){
        $request_uri = substr($request_uri, strlen(FORUM_URL_BASE));
}

lines to your rewrite.php near before

// We go through every rewrite rule

line.