| Sunday 23 November 2008 11:14:40 am 
                                                                 I've put the configuration for siteaccess with static cache and without in separate config files. Exponential.conf 
#
# Let Exponential handle (almost) all requests
#
url.rewrite-once += (
        #
        # download URLs are for Exponential
        #
        "^/content/download/.*$" => "/index.php$1",
        #
        # CSS etc. are handled by lighttpd
        #
        "^/.*\.(txt|css|html|htm|pdf|js|png|gif|jpe?g|htc|class|jar|swf)$" => "$
0",
        #
        # Everything else gets done by Exponential
        #
        "^/.*?(\?.*)?$" => "/index.php$1"
)
Exponential-static.conf 
#
# Static cache (needs mod_magnet)
#
magnet.attract-physical-path-to = ( "/etc/lighttpd/static-cache.lua" )
 static-cache.lua 
-- 
-- Static cache for Exponential
--
--
-- Requires Perl-comaptible regular expressions
--
require("rex_pcre")
function m (s, p)
        return rex_pcre.match(s, p)
end
function norm (s)
        return m (s, "^(.*[^/])") or ""
end
uri_path = lighty.env["uri.path"]
static_cache_file = norm(lighty.env["physical.doc-root"]) .. "/static" .. norm(uri_path) .. "/index.html"
--
-- Do not rewrite some URLs
--
rewrite = 
        not(m(uri_path, "[.](txt|css|html?|pdf|js|png|gif|jpe?g|htc|class|jar|ico|swf)$")) or
        m(uri_path, "^/content/download/.*$") 
--
-- Never rewrite index.php or index_treemenu.php
--
rewrite = rewrite and not(m(uri_path, "^/index(_treemenu)?\.php")) 
--
-- If we can't rewrite, exit immediately
--
if (not(rewrite)) then
        return
end
--
-- Special handling of treemenu
--
if (m(uri_path, "^/content/treemenu/?$")) then
        lighty.env["uri.path"] = "/index_treemenu.php"
        lighty.env["physical.rel-path"] = lighty.env["uri.path"]
        lighty.env["physical.path"] = lighty.env["physical.doc-root"] .. lighty.env["physical.rel-path"]
        return
end
--
-- Some URLs can't be cached
--
cache = rewrite and (
                lighty.env["request.method"] ~= "POST" and
                lighty.env["uri.query"] == nil
                )
                
-- print ("Initial URI: " .. lighty.env["request.uri"])
-- print ("Rewrite = " .. (rewrite and "true" or "false") .. ", Cache = " .. (cache and "true" or "false")) 
if cache then
        -- print ("Stat'ing : " .. static_cache_file)
        if not(nil == lighty.stat(static_cache_file)) then
                lighty.content = { { filename = static_cache_file } }
                lighty.header["Content-Type"] = "text/html"
                return 200
        else
                rewrite = true
        end
end
if (rewrite) then
        lighty.env["request.uri"] = lighty.env["uri.path"]
        lighty.env["uri.path"] = "/index.php" 
        lighty.env["physical.rel-path"] = lighty.env["uri.path"]
        lighty.env["physical.path"] = lighty.env["physical.doc-root"] .. lighty.env["physical.rel-path"]
        -- print ("Restarting: " .. lighty.env["uri.path"]) 
end
-- print ("Normal request handling for: " .. lighty.env["uri.path"])
Accessible website starting from eZ publish 3.0 (currently: 4.1.0): http://pluspunkt.at
                                                                 |