Forums / Suggestions / More Lighttpd Support

More Lighttpd Support

Author Message

DeAndre Johnson

Friday 21 November 2008 4:44:25 am

For those of us that like living on the edge :) I would like to see more lighttpd support

I am, because I choose to be!

Peter Putzer

Friday 21 November 2008 5:17:06 am

What exactly are you missing? For static cache support, have a look at http://ez.no/developer/forum/install_configuration/ez_publish_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

Accessible website starting from eZ publish 3.0 (currently: 4.1.0): http://pluspunkt.at

DeAndre Johnson

Saturday 22 November 2008 3:54:14 am

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.

I am, because I choose to be!

André R.

Saturday 22 November 2008 4:41:19 am

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/install_configuration/solved_webdav_3_10_0_admin_authentication_failed/

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Peter Putzer

Sunday 23 November 2008 11:14:40 am

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

Accessible website starting from eZ publish 3.0 (currently: 4.1.0): http://pluspunkt.at

DeAndre Johnson

Tuesday 25 November 2008 5:24:41 am

Thanks, will give it a try

I am, because I choose to be!

Peter Putzer

Tuesday 25 November 2008 6:05:00 am

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

Greetings,
Peter

Accessible website starting from eZ publish 3.0 (currently: 4.1.0): http://pluspunkt.at