# A lighttpd config file for Domoticz, serving the UI as Static content and proying only API calls to Domoticz # # Make sure you set the Document-root to your full-path of the Domoticz WWW directory # # All calls to 'json.htm' will be proxied to the Domoticz webserver/webservice that is expected to run on port 8080 (No SSL) # You can start Domoticz for example with the following config # sudo ./bin/domoticz -www 8080 -wwwroot www -loglevel debug,error -debuglevel webserver # # Domoticz will show the (web)requests it handles (should be the json.htm ones only) # And you can tail the lighttpd logfile (/tmp/lighttpd.log) to see all other static requests being handled by lighttpd # # Start this script from your Domoticz home directory with: # lighttpd -D -f test/lighttpd.conf # # Now you can access Domoticz on port 8888 (http://localhost:8888) server.document-root = "/home/vagrant/domoticz/www/" server.port = 8888 accesslog.format = "%h %V %u %t \"%r\" %>s %b" accesslog.filename = "/tmp/lighttpd.log" index-file.names = ( "index.html" ) server.modules = ( "mod_indexfile", "mod_accesslog", "mod_rewrite", "mod_proxy", "mod_magnet" ) mimetype.assign = ( ".html" => "text/html;charset=UTF-8", ".txt" => "text/plain;charset=UTF-8", ".css" => "text/css;charset=UTF-8", ".js" => "text/javascript;charset=UTF-8", ".jpg" => "image/jpeg", ".png" => "image/png", ".json" => "application/json;charset=UTF-8" ) # Handle the zipped Javascript files $HTTP["url"] =~ ".js" { url.rewrite-if-not-file = ( "^\/js\/(.*)\.js$" => "/js/$1.js.gz" ) magnet.attract-physical-path-to = ( "/home/vagrant/domoticz/test/lighttpd_gzippedjs.lua" ) } # Handle the zipped language files $HTTP["url"] =~ ".json" { url.rewrite-if-not-file = ( "^\/i18n\/(.*)\.json$" => "/i18n/$1.json.gz" ) magnet.attract-physical-path-to = ( "/home/vagrant/domoticz/test/lighttpd_gzippedjson.lua" ) } proxy.server = ( "/json.htm" => ( "domoticzservice" => ( "host" => "localhost", "port" => "8080" ) ) )