LQPP/Installation/lighttpd

Aus Piratenwiki
Wechseln zu: Navigation, Suche
server.modules += (
 "mod_cgi",
 "mod_alias",
 "mod_setenv",
 "mod_rewrite",
 "mod_redirect",
)
# Redirect fuer /lf/ auf /pp/
       url.redirect += (
     "^/lf$" => "/pp/",
     "^/lf/(.*)" => "/pp/$1",
)
# Enable CGI-Execution of *.lua files through lua binary
cgi.assign += ( ".lua" => "/usr/bin/lua" )
# Connect external URLs to server static files and the webmcp cgi interface
alias.url += (
 "/pp/fastpath/" => "/opt/liquid_feedback/webapp/fastpath/pp/",
 "/pp/static/"   => "/opt/liquid_feedback/webapp/static/",
 "/pp/"          => "/opt/liquid_feedback/webmcp/framework/cgi-bin/",  "/bb/fastpath/" => "/opt/liquid_feedback/webapp/fastpath/bb/"
)
$HTTP["url"] =~ "^/pp/" {
 setenv.add-environment += (
   "WEBMCP_CONFIG_NAME"  => "pp" ,
   "WEBMCP_APP_BASEPATH" => "/opt/liquid_feedback/webapp",
 )
}
# URL beautification
url.rewrite-once += (
 # do not rewrite redirects from /lf/
     "^(/lf.*)" => "$1",
 # do not rewrite static URLs
     "^/([a-z][a-z])/fastpath/(.*)$" => "/$1/fastpath/$2",
     "^/([a-z][a-z])/static/(.*)$" => "/$1/static/$2",
 # base URL
     "^/([a-z][a-z])/(\?(.*))?$" => "/$1/webmcp-wrapper.lua?_webmcp_urldepth=0&_webmcp_module=index&_webmcp_view=index&$3",
 # module base URLs
     "^/([a-z][a-z])/([^/\?]+)/(\?(.*))?$" => "/$1/webmcp-wrapper.lua?_webmcp_urldepth=1&_webmcp_module=$2&_webmcp_view=index&$4",
 # actions
     "^/([a-z][a-z])/([^/\?]+)/([^/\.\?]+)(\?(.*))?$" => "/$1/webmcp-wrapper.lua?_webmcp_urldepth=1&_webmcp_module=$2&_webmcp_action=$3&$5",
 # views without numeric id or string ident
     "^/([a-z][a-z])/([^/\?]+)/([^/\.\?]+)\.([^/\?]+)(\?(.*))?$" => "/$1/webmcp-wrapper.lua?_webmcp_urldepth=1&_webmcp_module=$2&_webmcp_view=$3&_webmcp_suffix=$4&$6",
 # views with numeric id or string ident
     "^/([a-z][a-z])/([^/\?]+)/([^/\?]+)/([^/\.\?]+)\.([^/\?]+)(\?(.*))?$" => "/$1/webmcp-wrapper.lua?_webmcp_urldepth=2&_webmcp_module=$2&_webmcp_view=$3&_webmcp_id=$4&_webmcp_suffix=$5&$7",
)
# Redirects for URLs without trailing slashes
url.redirect += (
 # base URL without trailing slash
     "^/([a-z][a-z])$" => "/$1/",
 # module base URL without trailing slash
     "^/([a-z][a-z])/([^/\?]+)$" => "/$1/$2/",
)
$SERVER["socket"] == ":80" {
 url.redirect += (
   "^/(.*)$" => "https://lqfb.piratenpartei.de$0"
 )
}
$HTTP["url"] =~ "^/pp/fastpath/" {
 cgi.assign = ( "" => "" )
 setenv.add-response-header = ( "Cache-Control" => "private; max-age=86400" )
}