webmcp
view doc/lighttpd.sample.conf @ 0:9fdfb27f8e67
Version 1.0.0
| author | jbe/bsw | 
|---|---|
| date | Sun Oct 25 12:00:00 2009 +0100 (2009-10-25) | 
| parents | |
| children | 2f8d8edd1836 | 
 line source
     1 # Lighttpd modules needed by WebMCP
     2 server.modules += (
     3   "mod_cgi",
     4   "mod_alias",
     5   "mod_setenv",
     6   "mod_rewrite",
     7   "mod_redirect",
     8  )
    10 # Enable CGI-Execution of *.lua files through lua binary
    11 cgi.assign += ( ".lua" => "/__INSERT_LOCAL_FILE_PATH_TO_LUA_BINARY_HERE__/lua" )
    13 # Connect external URLs to server static files and the webmcp cgi interface
    14 alias.url += (
    15   "/webmcp-demo/static/" => "/__INSERT_LOCAL_FILE_PATH_TO_DEMO_APPLICATION_HERE__/static/",
    16   "/webmcp-demo/"        => "/__INSERT_LOCAL_FILE_PATH_TO_WEBMCP_FRAMEWORK_HERE__/cgi-bin/" )
    18 # Configure environment for demo application    
    19 $HTTP["url"] =~ "^/webmcp-demo/" {
    20   setenv.add-environment += (
    21     "WEBMCP_APP_BASEPATH" => "/__INSERT_LOCAL_FILE_PATH_TO_DEMO_APPLICATION_HERE__",
    22     "WEBMCP_CONFIG_NAME"  => "demo")
    23 }
    25 # URL beautification
    26 url.rewrite-once += (
    28   # do not rewrite static URLs
    29       "^/webmcp-demo/static/(.*)$" =>
    30       "/webmcp-demo/static/$1",
    32   # base URL
    33       "^/webmcp-demo/(\?(.*))?$" =>
    34       "/webmcp-demo/webmcp-wrapper.lua?_webmcp_urldepth=0&_webmcp_module=index&_webmcp_view=index&$2",
    36   # module base URLs
    37       "^/webmcp-demo/([^/\?]+)/(\?(.*))?$" =>
    38       "/webmcp-demo/webmcp-wrapper.lua?_webmcp_urldepth=1&_webmcp_module=$1&_webmcp_view=index&$3",
    40   # actions
    41       "^/webmcp-demo/([^/\?]+)/([^/\.\?]+)(\?(.*))?$" =>
    42       "/webmcp-demo/webmcp-wrapper.lua?_webmcp_urldepth=1&_webmcp_module=$1&_webmcp_action=$2&$4",
    44   # views without numeric id or string ident
    45       "^/webmcp-demo/([^/\?]+)/([^/\.\?]+)\.([^/\?]+)(\?(.*))?$" =>
    46       "/webmcp-demo/webmcp-wrapper.lua?_webmcp_urldepth=1&_webmcp_module=$1&_webmcp_view=$2&_webmcp_suffix=$3&$5",
    48   # views with numeric id or string ident
    49       "^/webmcp-demo/([^/\?]+)/([^/\?]+)/([^/\.\?]+)\.([^/\?]+)(\?(.*))?$" =>
    50       "/webmcp-demo/webmcp-wrapper.lua?_webmcp_urldepth=2&_webmcp_module=$1&_webmcp_view=$2&_webmcp_id=$3&_webmcp_suffix=$4&$6",
    52 )
    54 # Redirects for URLs without trailing slashes
    55 url.redirect += (
    56   # base URL without trailing slash
    57       "^/webmcp-demo$" => "/webmcp-demo/",
    58   # module base URL without trailing slash
    59       "^/webmcp-demo/([^/\?]+)$" => "/webmcp-demo/$1/",
    60 )
