eZ Community » Forums » Suggestions » More Lighttpd Support
expandshrink

More Lighttpd Support

More Lighttpd Support

Friday 21 November 2008 1:44:25 pm - 6 replies

For those of us that like living on the edge happy.gif Emoticon I would like to see more lighttpd support

Friday 21 November 2008 2:17:06 pm

What exactly are you missing? For static cache support, have a look at http://ez.no/developer/forum/inst...ublish_lighttpd_static_cache_success (although the script given there is not quite working on 3.10/4.0 - I'll post my updated script in the evening).

Greetings,
Peter

Saturday 22 November 2008 12:54:14 pm

My lighttpd set up with virtual host is like this
HTTP["host"] =~ "(^|\.)mystite\.com$" {
server.document-root = "/var/www/html/myvirtualhost"
url.rewrite-once = (
"^/var/.*" => "$0",
"^/.*\.(css|html|htm|pdf|js|ico|png|gif|jpe?g)$" => "$0",
)
}

I need configuration to work with 4.0.1. So, yes I'm interested in your config.

I'm looking for info on how to set up ez webdav on lighttpd.

Saturday 22 November 2008 1:41:19 pm

Have you seen thees threads?

config:
http://ez.no/developer/forum/suggestions/memcache/(offset)/20

Webdav:
http://ez.no/developer/forum/developer/lighttpd_and_ez_webdav_it_works
http://ez.no/developer/forum/inst..._3_10_0_admin_authentication_failed/

Sunday 23 November 2008 8:14:40 pm

I've put the configuration for siteaccess with static cache and without in separate config files.

ezpublish.conf

#
# Let eZ Publish handle (almost) all requests
#
url.rewrite-once += (
        #
        # download URLs are for eZ Publish
        #
        "^/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 eZ Publish
        #
        "^/.*?(\?.*)?$" => "/index.php$1"
)

ezpublish-static.conf

#
# Static cache (needs mod_magnet)
#
magnet.attract-physical-path-to = ( "/etc/lighttpd/static-cache.lua" )

static-cache.lua

-- 
-- Static cache for eZ Publish
--

--
-- 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"])

Modified on Tuesday 25 November 2008 3:03:46 pm by Peter Putzer

Tuesday 25 November 2008 2:24:41 pm

Thanks, will give it a try

Tuesday 25 November 2008 3:05:00 pm

Please note that I had some duplicated lines in the original posting of the Lua script. I've fixed that now.

Greetings,
Peter

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from