summaryrefslogtreecommitdiff
path: root/yocto-poky/meta/recipes-extended/lighttpd
diff options
context:
space:
mode:
Diffstat (limited to 'yocto-poky/meta/recipes-extended/lighttpd')
-rw-r--r--yocto-poky/meta/recipes-extended/lighttpd/lighttpd/0001-mod_cgi-buffers-data-without-bound.patch387
-rw-r--r--yocto-poky/meta/recipes-extended/lighttpd/lighttpd/index.html.lighttpd1
-rw-r--r--yocto-poky/meta/recipes-extended/lighttpd/lighttpd/lighttpd34
-rw-r--r--yocto-poky/meta/recipes-extended/lighttpd/lighttpd/lighttpd.conf331
-rw-r--r--yocto-poky/meta/recipes-extended/lighttpd/lighttpd/lighttpd.service12
-rw-r--r--yocto-poky/meta/recipes-extended/lighttpd/lighttpd/pkgconfig.patch33
-rw-r--r--yocto-poky/meta/recipes-extended/lighttpd/lighttpd_1.4.36.bb77
7 files changed, 875 insertions, 0 deletions
diff --git a/yocto-poky/meta/recipes-extended/lighttpd/lighttpd/0001-mod_cgi-buffers-data-without-bound.patch b/yocto-poky/meta/recipes-extended/lighttpd/lighttpd/0001-mod_cgi-buffers-data-without-bound.patch
new file mode 100644
index 000000000..a9df1744a
--- /dev/null
+++ b/yocto-poky/meta/recipes-extended/lighttpd/lighttpd/0001-mod_cgi-buffers-data-without-bound.patch
@@ -0,0 +1,387 @@
+From e6ccbab5d42b110ac4f6ce1f72cb1e9ccbe4400a Mon Sep 17 00:00:00 2001
+From: Li xin <lixin.fnst@cn.fujitsu.com>
+Date: Tue, 16 Jun 2015 19:02:38 +0900
+Subject: [PATCH] mod_cgi buffers data without bound so fix it
+
+Upstream-Status: Submitted [http://redmine.lighttpd.net/issues/1264]
+
+Signed-off-by: Li Xin <lixin.fnst@cn.fujitsu.com>
+
+Update context for 1.4.36.
+
+Signed-off-by: Kai Kang <kai.kang@windriver.com>
+---
+ doc/config/lighttpd.conf | 8 ++
+ src/mod_cgi.c | 188 ++++++++++++++++++++++++++++++++++++++++++++---
+ 2 files changed, 187 insertions(+), 9 deletions(-)
+
+diff --git a/doc/config/lighttpd.conf b/doc/config/lighttpd.conf
+index 60b0ae1..9c101a7 100644
+--- a/doc/config/lighttpd.conf
++++ b/doc/config/lighttpd.conf
+@@ -375,6 +375,14 @@ server.upload-dirs = ( "/var/tmp" )
+ ##
+ #######################################################################
+
++#######################################################################
++##
++##
++## maximum bytes in send_raw before backing off [KByte]
++## cgi.high-waterlevel = 10240
++## minimum bytes in send_raw to disable backoff [KByte]
++## cgi.low-waterlevel = 5120
++#######################################################################
+
+ #######################################################################
+ ##
+diff --git a/src/mod_cgi.c b/src/mod_cgi.c
+index 01b1877..7c67eb5 100644
+--- a/src/mod_cgi.c
++++ b/src/mod_cgi.c
+@@ -38,6 +38,10 @@
+
+ #include "version.h"
+
++/* for output logs */
++char msgbuf[2048];
++
++
+ enum {EOL_UNSET, EOL_N, EOL_RN};
+
+ typedef struct {
+@@ -53,9 +57,19 @@ typedef struct {
+ size_t size;
+ } buffer_pid_t;
+
++struct handler_ctx;
++
++typedef struct {
++ struct handler_ctx **hctx;
++ size_t used;
++ size_t size;
++} buffer_ctx_t;
++
+ typedef struct {
+ array *cgi;
+ unsigned short execute_x_only;
++ unsigned int high_waterlevel; /* maximum bytes in send_raw before backing off */
++ unsigned int low_waterlevel; /* minimum bytes in send_raw to disable backoff */
+ } plugin_config;
+
+ typedef struct {
+@@ -68,9 +82,11 @@ typedef struct {
+ plugin_config **config_storage;
+
+ plugin_config conf;
++
++ buffer_ctx_t cgi_ctx;
+ } plugin_data;
+
+-typedef struct {
++typedef struct handler_ctx {
+ pid_t pid;
+ int fd;
+ int fde_ndx; /* index into the fd-event buffer */
+@@ -78,11 +94,16 @@ typedef struct {
+ connection *remote_conn; /* dumb pointer */
+ plugin_data *plugin_data; /* dumb pointer */
+
++ int throttling; /* 1=waiting for send_raw buffer to drain */
++ off_t high_waterlevel; /* maximum bytes in send_raw before backing off */
++ off_t low_waterlevel; /* minimum bytes in send_raw to disable backoff */
++ off_t bytes_in_buffer;
++
+ buffer *response;
+ buffer *response_header;
+ } handler_ctx;
+
+-static handler_ctx * cgi_handler_ctx_init(void) {
++static handler_ctx * cgi_handler_ctx_init(plugin_data *p) {
+ handler_ctx *hctx = calloc(1, sizeof(*hctx));
+
+ force_assert(hctx);
+@@ -90,13 +111,26 @@ static handler_ctx * cgi_handler_ctx_init(void) {
+ hctx->response = buffer_init();
+ hctx->response_header = buffer_init();
+
++ hctx->throttling = 0;
++ hctx->high_waterlevel = (off_t)p->conf.high_waterlevel * 1024;
++ hctx->low_waterlevel = (off_t)p->conf.low_waterlevel * 1024;
++ if (hctx->low_waterlevel >= hctx->high_waterlevel) {
++ hctx->low_waterlevel = hctx->high_waterlevel * 3 / 4; /* 75% */
++ }
++ hctx->bytes_in_buffer = 0;
++
+ return hctx;
+ }
+
+-static void cgi_handler_ctx_free(handler_ctx *hctx) {
++static void cgi_handler_ctx_free(server *srv, handler_ctx *hctx) {
+ buffer_free(hctx->response);
+ buffer_free(hctx->response_header);
+
++ /* to avoid confusion */
++ if (hctx->throttling) {
++ log_error_write(srv, __FILE__, __LINE__, "s", "unthrottled");
++ }
++
+ free(hctx);
+ }
+
+@@ -154,6 +188,8 @@ SETDEFAULTS_FUNC(mod_fastcgi_set_defaults) {
+ config_values_t cv[] = {
+ { "cgi.assign", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION }, /* 0 */
+ { "cgi.execute-x-only", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 1 */
++ { "cgi.high-waterlevel", NULL, T_CONFIG_INT, T_CONFIG_SCOPE_CONNECTION }, /* 2 */
++ { "cgi.low-waterlevel", NULL, T_CONFIG_INT, T_CONFIG_SCOPE_CONNECTION }, /* 3 */
+ { NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET}
+ };
+
+@@ -169,9 +205,13 @@ SETDEFAULTS_FUNC(mod_fastcgi_set_defaults) {
+
+ s->cgi = array_init();
+ s->execute_x_only = 0;
++ s->high_waterlevel = 0; /* 0 == disabled */
++ s->low_waterlevel = 0;
+
+ cv[0].destination = s->cgi;
+ cv[1].destination = &(s->execute_x_only);
++ cv[2].destination = &(s->high_waterlevel);
++ cv[3].destination = &(s->low_waterlevel);
+
+ p->config_storage[i] = s;
+
+@@ -184,6 +224,51 @@ SETDEFAULTS_FUNC(mod_fastcgi_set_defaults) {
+ }
+
+
++static void cgi_recount_bytes_in_buffer(handler_ctx *hctx)
++{
++ chunkqueue *cq = hctx->remote_conn->write_queue;
++ hctx->bytes_in_buffer = chunkqueue_length(cq) - chunkqueue_written(cq);
++}
++
++
++static void cgi_throttling_control(server *srv, handler_ctx *hctx)
++{
++ cgi_recount_bytes_in_buffer(hctx);
++
++#ifdef DEBUG
++ sprintf(msgbuf, "throttling=%d, chars=%llu, high=%llu, low=%llu",
++ hctx->throttling, hctx->bytes_in_buffer,
++ hctx->high_waterlevel, hctx->low_waterlevel);
++ log_error_write(srv, __FILE__, __LINE__, "ss",
++ "(debug) throttling control,", msgbuf);
++#endif
++
++ if (hctx->throttling) {
++ sprintf(msgbuf, "throttling; chars in queue=%llu,"
++ " low-waterlevel=%llu, high-waterlevel=%llu",
++ hctx->bytes_in_buffer,
++ hctx->low_waterlevel, hctx->high_waterlevel);
++ log_error_write(srv, __FILE__, __LINE__, "s", msgbuf);
++ if (hctx->bytes_in_buffer <= hctx->low_waterlevel) {
++ fdevent_event_set(srv->ev, &(hctx->fde_ndx), hctx->fd, FDEVENT_IN);
++ hctx->throttling = 0;
++ log_error_write(srv, __FILE__, __LINE__, "s", "unthrottled");
++ }
++ } else {
++ if (hctx->high_waterlevel != 0 &&
++ hctx->high_waterlevel <= hctx->bytes_in_buffer) {
++ fdevent_event_del(srv->ev, &(hctx->fde_ndx), hctx->fd);
++ hctx->throttling = 1;
++ sprintf(msgbuf, "throttled; chars in queue=%llu,"
++ " low-waterlevel=%llu, high-waterlevel=%llu",
++ hctx->bytes_in_buffer,
++ hctx->low_waterlevel, hctx->high_waterlevel);
++ log_error_write(srv, __FILE__, __LINE__, "s", msgbuf);
++ }
++ }
++}
++
++
+ static int cgi_pid_add(server *srv, plugin_data *p, pid_t pid) {
+ int m = -1;
+ size_t i;
+@@ -230,6 +315,39 @@ static int cgi_pid_del(server *srv, plugin_data *p, pid_t pid) {
+ return 0;
+ }
+
++
++static void cgi_ctx_add(plugin_data *p, handler_ctx *hctx) {
++ buffer_ctx_t *r = &(p->cgi_ctx);
++
++ if (r->size == 0) {
++ r->size = 16;
++ r->hctx = malloc(sizeof(*r->hctx) * r->size);
++ } else if (r->used == r->size) {
++ r->size += 16;
++ r->hctx = realloc(r->hctx, sizeof(*r->hctx) * r->size);
++ }
++
++ r->hctx[r->used++] = hctx;
++}
++
++static void cgi_ctx_del(plugin_data *p, handler_ctx *hctx) {
++ size_t i;
++ buffer_ctx_t *r = &(p->cgi_ctx);
++
++ for (i = 0; i < r->used; i++) {
++ if (r->hctx[i] == hctx) break;
++ }
++
++ if (i != r->used) {
++ /* found */
++
++ if (i != r->used - 1) {
++ r->hctx[i] = r->hctx[r->used - 1];
++ }
++ r->used--;
++ }
++}
++
+ static int cgi_response_parse(server *srv, connection *con, plugin_data *p, buffer *in) {
+ char *ns;
+ const char *s;
+@@ -380,6 +498,14 @@ static int cgi_demux_response(server *srv, handler_ctx *hctx) {
+
+ buffer_commit(hctx->response, n);
+
++#ifdef DEBUG
++ sprintf(msgbuf, "n=%d, bytes_out=%llu, bytes_in=%llu", n,
++ (unsigned long long)con->write_queue->bytes_out,
++ (unsigned long long)con->write_queue->bytes_in);
++ log_error_write(srv, __FILE__, __LINE__, "ss",
++ "(debug) read,", msgbuf);
++#endif
++
+ /* split header from body */
+
+ if (con->file_started == 0) {
+@@ -503,7 +629,20 @@ static int cgi_demux_response(server *srv, handler_ctx *hctx) {
+ }
+ } else {
+ http_chunk_append_buffer(srv, con, hctx->response);
++#ifdef DEBUG
++ sprintf(msgbuf, "n=%d, bytes_out=%llu, bytes_in=%llu, limit=%llu", n,
++ (unsigned long long)con->write_queue->bytes_out,
++ (unsigned long long)con->write_queue->bytes_in,
++ (unsigned long long)hctx->high_waterlevel);
++ log_error_write(srv, __FILE__, __LINE__,
++ "ss", "(debug) append,", msgbuf);
++#endif
+ joblist_append(srv, con);
++
++ cgi_throttling_control(srv, hctx);
++ if (hctx->throttling) {
++ return FDEVENT_HANDLED_NOT_FINISHED;
++ }
+ }
+
+ #if 0
+@@ -553,8 +692,9 @@ static handler_t cgi_connection_close(server *srv, handler_ctx *hctx) {
+ con->plugin_ctx[p->id] = NULL;
+
+ /* is this a good idea ? */
+- cgi_handler_ctx_free(hctx);
+-
++ cgi_ctx_del(p, hctx);
++ cgi_handler_ctx_free(srv, hctx);
++
+ /* if waitpid hasn't been called by response.c yet, do it here */
+ if (pid) {
+ /* check if the CGI-script is already gone */
+@@ -1105,7 +1245,8 @@ static int cgi_create_env(server *srv, connection *con, plugin_data *p, buffer *
+ con->mode = p->id;
+ buffer_reset(con->physical.path);
+
+- hctx = cgi_handler_ctx_init();
++ hctx = cgi_handler_ctx_init(p);
++ cgi_ctx_add(p, hctx);
+
+ hctx->remote_conn = con;
+ hctx->plugin_data = p;
+@@ -1114,6 +1255,11 @@ static int cgi_create_env(server *srv, connection *con, plugin_data *p, buffer *
+ hctx->fde_ndx = -1;
+
+ con->plugin_ctx[p->id] = hctx;
++#ifdef DEBUG
++ sprintf(msgbuf, "hctx=%p, con=%p", (void*)hctx, (void*)con);
++ log_error_write(srv, __FILE__, __LINE__, "ss",
++ "(debug) hctx generated, ", msgbuf);
++#endif
+
+ fdevent_register(srv->ev, hctx->fd, cgi_handle_fdevent, hctx);
+ fdevent_event_set(srv->ev, &(hctx->fde_ndx), hctx->fd, FDEVENT_IN);
+@@ -1128,7 +1274,8 @@ static int cgi_create_env(server *srv, connection *con, plugin_data *p, buffer *
+
+ close(hctx->fd);
+
+- cgi_handler_ctx_free(hctx);
++ cgi_ctx_del(p, hctx);
++ cgi_handler_ctx_free(srv, hctx);
+
+ con->plugin_ctx[p->id] = NULL;
+
+@@ -1153,6 +1300,8 @@ static int mod_cgi_patch_connection(server *srv, connection *con, plugin_data *p
+
+ PATCH(cgi);
+ PATCH(execute_x_only);
++ PATCH(high_waterlevel);
++ PATCH(low_waterlevel);
+
+ /* skip the first, the global context */
+ for (i = 1; i < srv->config_context->used; i++) {
+@@ -1170,6 +1319,10 @@ static int mod_cgi_patch_connection(server *srv, connection *con, plugin_data *p
+ PATCH(cgi);
+ } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("cgi.execute-x-only"))) {
+ PATCH(execute_x_only);
++ } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("cgi.high-waterlevel"))) {
++ PATCH(high_waterlevel);
++ } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("cgi.low-waterlevel"))) {
++ PATCH(low_waterlevel);
+ }
+ }
+ }
+@@ -1222,6 +1375,21 @@ URIHANDLER_FUNC(cgi_is_handled) {
+ TRIGGER_FUNC(cgi_trigger) {
+ plugin_data *p = p_d;
+ size_t ndx;
++
++ for (ndx = 0; ndx < p->cgi_ctx.used; ndx++) {
++ handler_ctx *hctx = p->cgi_ctx.hctx[ndx];
++#ifdef DEBUG
++ connection *con = hctx->remote_conn;
++
++ sprintf(msgbuf, "hctx=%p, con=%p, bytes_in_buffer=%llu",
++ (void*)hctx, (void*)con,
++ (unsigned long long)hctx->bytes_in_buffer);
++ log_error_write(srv, __FILE__, __LINE__, "ss",
++ "(debug) found using ctx,", msgbuf);
++#endif
++ cgi_throttling_control(srv, hctx);
++ }
++
+ /* the trigger handle only cares about lonely PID which we have to wait for */
+ #ifndef __WIN32
+
+@@ -1330,7 +1498,8 @@ SUBREQUEST_FUNC(mod_cgi_handle_subrequest) {
+ log_error_write(srv, __FILE__, __LINE__, "sds", "cgi close failed ", hctx->fd, strerror(errno));
+ }
+
+- cgi_handler_ctx_free(hctx);
++ cgi_ctx_del(p, hctx);
++ cgi_handler_ctx_free(srv, hctx);
+
+ con->plugin_ctx[p->id] = NULL;
+
+@@ -1362,7 +1531,8 @@ SUBREQUEST_FUNC(mod_cgi_handle_subrequest) {
+ log_error_write(srv, __FILE__, __LINE__, "sds", "cgi close failed ", hctx->fd, strerror(errno));
+ }
+
+- cgi_handler_ctx_free(hctx);
++ cgi_ctx_del(p, hctx);
++ cgi_handler_ctx_free(srv, hctx);
+
+ con->plugin_ctx[p->id] = NULL;
+ return HANDLER_FINISHED;
diff --git a/yocto-poky/meta/recipes-extended/lighttpd/lighttpd/index.html.lighttpd b/yocto-poky/meta/recipes-extended/lighttpd/lighttpd/index.html.lighttpd
new file mode 100644
index 000000000..f5f1c377b
--- /dev/null
+++ b/yocto-poky/meta/recipes-extended/lighttpd/lighttpd/index.html.lighttpd
@@ -0,0 +1 @@
+<html><body><h1>It works!</h1></body></html>
diff --git a/yocto-poky/meta/recipes-extended/lighttpd/lighttpd/lighttpd b/yocto-poky/meta/recipes-extended/lighttpd/lighttpd/lighttpd
new file mode 100644
index 000000000..bf89a60b7
--- /dev/null
+++ b/yocto-poky/meta/recipes-extended/lighttpd/lighttpd/lighttpd
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+DAEMON=/usr/sbin/lighttpd
+NAME=lighttpd
+DESC="Lighttpd Web Server"
+OPTS="-f /etc/lighttpd.conf"
+
+case "$1" in
+ start)
+ echo -n "Starting $DESC: "
+ start-stop-daemon --start -x "$DAEMON" -- $OPTS
+ echo "$NAME."
+ ;;
+ stop)
+ echo -n "Stopping $DESC: "
+ start-stop-daemon --stop -x "$DAEMON"
+ echo "$NAME."
+ ;;
+ restart|force-reload)
+ echo -n "Restarting $DESC: "
+ start-stop-daemon --stop -x "$DAEMON"
+ sleep 1
+ start-stop-daemon --start -x "$DAEMON" -- $OPTS
+ echo "$NAME."
+ ;;
+ *)
+ N=/etc/init.d/$NAME
+ echo "Usage: $N {start|stop|restart|force-reload}" >&2
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/yocto-poky/meta/recipes-extended/lighttpd/lighttpd/lighttpd.conf b/yocto-poky/meta/recipes-extended/lighttpd/lighttpd/lighttpd.conf
new file mode 100644
index 000000000..6e8402d24
--- /dev/null
+++ b/yocto-poky/meta/recipes-extended/lighttpd/lighttpd/lighttpd.conf
@@ -0,0 +1,331 @@
+# lighttpd configuration file
+#
+# use it as a base for lighttpd 1.0.0 and above
+#
+# $Id: lighttpd.conf,v 1.7 2004/11/03 22:26:05 weigon Exp $
+
+############ Options you really have to take care of ####################
+
+## modules to load
+# at least mod_access and mod_accesslog should be loaded
+# all other module should only be loaded if really neccesary
+# - saves some time
+# - saves memory
+server.modules = (
+# "mod_rewrite",
+# "mod_redirect",
+# "mod_alias",
+ "mod_access",
+# "mod_cml",
+# "mod_trigger_b4_dl",
+# "mod_auth",
+# "mod_status",
+# "mod_setenv",
+# "mod_fastcgi",
+# "mod_proxy",
+# "mod_simple_vhost",
+# "mod_evhost",
+# "mod_userdir",
+# "mod_cgi",
+# "mod_compress",
+# "mod_ssi",
+# "mod_usertrack",
+# "mod_expire",
+# "mod_secdownload",
+# "mod_rrdtool",
+# "mod_webdav",
+ "mod_accesslog" )
+
+## a static document-root, for virtual-hosting take look at the
+## server.virtual-* options
+server.document-root = "/www/pages/"
+
+## where to send error-messages to
+server.errorlog = "/www/logs/lighttpd.error.log"
+
+# files to check for if .../ is requested
+index-file.names = ( "index.php", "index.html",
+ "index.htm", "default.htm" )
+
+## set the event-handler (read the performance section in the manual)
+# server.event-handler = "freebsd-kqueue" # needed on OS X
+
+# mimetype mapping
+mimetype.assign = (
+ ".pdf" => "application/pdf",
+ ".sig" => "application/pgp-signature",
+ ".spl" => "application/futuresplash",
+ ".class" => "application/octet-stream",
+ ".ps" => "application/postscript",
+ ".torrent" => "application/x-bittorrent",
+ ".dvi" => "application/x-dvi",
+ ".gz" => "application/x-gzip",
+ ".pac" => "application/x-ns-proxy-autoconfig",
+ ".swf" => "application/x-shockwave-flash",
+ ".tar.gz" => "application/x-tgz",
+ ".tgz" => "application/x-tgz",
+ ".tar" => "application/x-tar",
+ ".zip" => "application/zip",
+ ".mp3" => "audio/mpeg",
+ ".m3u" => "audio/x-mpegurl",
+ ".wma" => "audio/x-ms-wma",
+ ".wax" => "audio/x-ms-wax",
+ ".ogg" => "application/ogg",
+ ".wav" => "audio/x-wav",
+ ".gif" => "image/gif",
+ ".jpg" => "image/jpeg",
+ ".jpeg" => "image/jpeg",
+ ".png" => "image/png",
+ ".xbm" => "image/x-xbitmap",
+ ".xpm" => "image/x-xpixmap",
+ ".xwd" => "image/x-xwindowdump",
+ ".css" => "text/css",
+ ".html" => "text/html",
+ ".htm" => "text/html",
+ ".js" => "text/javascript",
+ ".asc" => "text/plain",
+ ".c" => "text/plain",
+ ".cpp" => "text/plain",
+ ".log" => "text/plain",
+ ".conf" => "text/plain",
+ ".text" => "text/plain",
+ ".txt" => "text/plain",
+ ".dtd" => "text/xml",
+ ".xml" => "text/xml",
+ ".mpeg" => "video/mpeg",
+ ".mpg" => "video/mpeg",
+ ".mov" => "video/quicktime",
+ ".qt" => "video/quicktime",
+ ".avi" => "video/x-msvideo",
+ ".asf" => "video/x-ms-asf",
+ ".asx" => "video/x-ms-asf",
+ ".wmv" => "video/x-ms-wmv",
+ ".bz2" => "application/x-bzip",
+ ".tbz" => "application/x-bzip-compressed-tar",
+ ".tar.bz2" => "application/x-bzip-compressed-tar"
+ )
+
+# Use the "Content-Type" extended attribute to obtain mime type if possible
+#mimetype.use-xattr = "enable"
+
+
+## send a different Server: header
+## be nice and keep it at lighttpd
+# server.tag = "lighttpd"
+
+#### accesslog module
+accesslog.filename = "/www/logs/access.log"
+debug.log-request-handling = "enable"
+
+
+
+
+## deny access the file-extensions
+#
+# ~ is for backupfiles from vi, emacs, joe, ...
+# .inc is often used for code includes which should in general not be part
+# of the document-root
+url.access-deny = ( "~", ".inc" )
+
+$HTTP["url"] =~ "\.pdf$" {
+ server.range-requests = "disable"
+}
+
+##
+# which extensions should not be handle via static-file transfer
+#
+# .php, .pl, .fcgi are most often handled by mod_fastcgi or mod_cgi
+static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
+
+######### Options that are good to be but not neccesary to be changed #######
+
+## bind to port (default: 80)
+#server.port = 81
+
+## bind to localhost (default: all interfaces)
+#server.bind = "grisu.home.kneschke.de"
+
+## error-handler for status 404
+#server.error-handler-404 = "/error-handler.html"
+#server.error-handler-404 = "/error-handler.php"
+
+## to help the rc.scripts
+#server.pid-file = "/var/run/lighttpd.pid"
+
+
+###### virtual hosts
+##
+## If you want name-based virtual hosting add the next three settings and load
+## mod_simple_vhost
+##
+## document-root =
+## virtual-server-root + virtual-server-default-host + virtual-server-docroot
+## or
+## virtual-server-root + http-host + virtual-server-docroot
+##
+#simple-vhost.server-root = "/home/weigon/wwwroot/servers/"
+#simple-vhost.default-host = "grisu.home.kneschke.de"
+#simple-vhost.document-root = "/pages/"
+
+
+##
+## Format: <errorfile-prefix><status-code>.html
+## -> ..../status-404.html for 'File not found'
+#server.errorfile-prefix = "/home/weigon/projects/lighttpd/doc/status-"
+
+## virtual directory listings
+#dir-listing.activate = "enable"
+
+## enable debugging
+#debug.log-request-header = "enable"
+#debug.log-response-header = "enable"
+#debug.log-request-handling = "enable"
+#debug.log-file-not-found = "enable"
+
+### only root can use these options
+#
+# chroot() to directory (default: no chroot() )
+#server.chroot = "/"
+
+## change uid to <uid> (default: don't care)
+#server.username = "wwwrun"
+
+## change uid to <uid> (default: don't care)
+#server.groupname = "wwwrun"
+
+#### compress module
+#compress.cache-dir = "/tmp/lighttpd/cache/compress/"
+#compress.filetype = ("text/plain", "text/html")
+
+#### proxy module
+## read proxy.txt for more info
+#proxy.server = ( ".php" =>
+# ( "localhost" =>
+# (
+# "host" => "192.168.0.101",
+# "port" => 80
+# )
+# )
+# )
+
+#### fastcgi module
+## read fastcgi.txt for more info
+## for PHP don't forget to set cgi.fix_pathinfo = 1 in the php.ini
+#fastcgi.server = ( ".php" =>
+# ( "localhost" =>
+# (
+# "socket" => "/tmp/php-fastcgi.socket",
+# "bin-path" => "/usr/local/bin/php"
+# )
+# )
+# )
+
+#### CGI module
+#cgi.assign = ( ".pl" => "/usr/bin/perl",
+# ".cgi" => "/usr/bin/perl" )
+#
+
+#### SSL engine
+#ssl.engine = "enable"
+#ssl.pemfile = "server.pem"
+
+#### status module
+#status.status-url = "/server-status"
+#status.config-url = "/server-config"
+
+#### auth module
+## read authentication.txt for more info
+#auth.backend = "plain"
+#auth.backend.plain.userfile = "lighttpd.user"
+#auth.backend.plain.groupfile = "lighttpd.group"
+
+#auth.backend.ldap.hostname = "localhost"
+#auth.backend.ldap.base-dn = "dc=my-domain,dc=com"
+#auth.backend.ldap.filter = "(uid=$)"
+
+#auth.require = ( "/server-status" =>
+# (
+# "method" => "digest",
+# "realm" => "download archiv",
+# "require" => "user=jan"
+# ),
+# "/server-config" =>
+# (
+# "method" => "digest",
+# "realm" => "download archiv",
+# "require" => "valid-user"
+# )
+# )
+
+#### url handling modules (rewrite, redirect, access)
+#url.rewrite = ( "^/$" => "/server-status" )
+#url.redirect = ( "^/wishlist/(.+)" => "http://www.123.org/$1" )
+
+#### both rewrite/redirect support back reference to regex conditional using %n
+#$HTTP["host"] =~ "^www\.(.*)" {
+# url.redirect = ( "^/(.*)" => "http://%1/$1" )
+#}
+
+#
+# define a pattern for the host url finding
+# %% => % sign
+# %0 => domain name + tld
+# %1 => tld
+# %2 => domain name without tld
+# %3 => subdomain 1 name
+# %4 => subdomain 2 name
+#
+#evhost.path-pattern = "/home/storage/dev/www/%3/htdocs/"
+
+#### expire module
+#expire.url = ( "/buggy/" => "access 2 hours", "/asdhas/" => "access plus 1 seconds 2 minutes")
+
+#### ssi
+#ssi.extension = ( ".shtml" )
+
+#### rrdtool
+#rrdtool.binary = "/usr/bin/rrdtool"
+#rrdtool.db-name = "/var/www/lighttpd.rrd"
+
+#### setenv
+#setenv.add-request-header = ( "TRAV_ENV" => "mysql://user@host/db" )
+#setenv.add-response-header = ( "X-Secret-Message" => "42" )
+
+## for mod_trigger_b4_dl
+# trigger-before-download.gdbm-filename = "/home/weigon/testbase/trigger.db"
+# trigger-before-download.memcache-hosts = ( "127.0.0.1:11211" )
+# trigger-before-download.trigger-url = "^/trigger/"
+# trigger-before-download.download-url = "^/download/"
+# trigger-before-download.deny-url = "http://127.0.0.1/index.html"
+# trigger-before-download.trigger-timeout = 10
+
+## for mod_cml
+## don't forget to add index.cml to server.indexfiles
+# cml.extension = ".cml"
+# cml.memcache-hosts = ( "127.0.0.1:11211" )
+
+#### variable usage:
+## variable name without "." is auto prefixed by "var." and becomes "var.bar"
+#bar = 1
+#var.mystring = "foo"
+
+## integer add
+#bar += 1
+## string concat, with integer cast as string, result: "www.foo1.com"
+#server.name = "www." + mystring + var.bar + ".com"
+## array merge
+#index-file.names = (foo + ".php") + index-file.names
+#index-file.names += (foo + ".php")
+
+#### include
+#include /etc/lighttpd/lighttpd-inc.conf
+## same as above if you run: "lighttpd -f /etc/lighttpd/lighttpd.conf"
+#include "lighttpd-inc.conf"
+
+#### include_shell
+#include_shell "echo var.a=1"
+## the above is same as:
+#var.a=1
+
+# include other config file fragments from lighttpd.d subdir
+include_shell "find /etc/lighttpd.d -maxdepth 1 -name '*.conf' -exec cat {} \;"
diff --git a/yocto-poky/meta/recipes-extended/lighttpd/lighttpd/lighttpd.service b/yocto-poky/meta/recipes-extended/lighttpd/lighttpd/lighttpd.service
new file mode 100644
index 000000000..66a907aa1
--- /dev/null
+++ b/yocto-poky/meta/recipes-extended/lighttpd/lighttpd/lighttpd.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Lightning Fast Webserver With Light System Requirements
+After=network.target
+
+[Service]
+ExecStartPre=@SBINDIR@/lighttpd -t -f @SYSCONFDIR@/lighttpd.conf
+ExecStart=@SBINDIR@/lighttpd -D -f @SYSCONFDIR@/lighttpd.conf
+ExecReload=@BASE_BINDIR@/kill -HUP $MAINPID
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/yocto-poky/meta/recipes-extended/lighttpd/lighttpd/pkgconfig.patch b/yocto-poky/meta/recipes-extended/lighttpd/lighttpd/pkgconfig.patch
new file mode 100644
index 000000000..e395f928c
--- /dev/null
+++ b/yocto-poky/meta/recipes-extended/lighttpd/lighttpd/pkgconfig.patch
@@ -0,0 +1,33 @@
+Use pkg-config for pcre dependency instead of -config script.
+
+Upstream-Status: Pending
+
+RP 2014/5/22
+
+
+Index: lighttpd-1.4.35/configure.ac
+===================================================================
+--- lighttpd-1.4.35.orig/configure.ac 2014-03-06 14:08:00.000000000 +0000
++++ lighttpd-1.4.35/configure.ac 2014-05-13 16:58:30.758471169 +0000
+@@ -309,16 +309,14 @@
+ AC_MSG_RESULT([$WITH_PCRE])
+
+ if test "$WITH_PCRE" != "no"; then
+- AC_PATH_PROG(PCRECONFIG, pcre-config)
+-
+- if test x"$PCRECONFIG" != x; then
+- PCRE_LIB=`$PCRECONFIG --libs`
+- CPPFLAGS="$CPPFLAGS `$PCRECONFIG --cflags`"
++ PKG_CHECK_MODULES(PCREPKG, [libpcre], [
++ PCRE_LIB=${PCREPKG_LIBS}
++ CPPFLAGS="$CPPFLAGS ${PCREPKG_CFLAGS}"
+ AC_DEFINE([HAVE_LIBPCRE], [1], [libpcre])
+ AC_DEFINE([HAVE_PCRE_H], [1], [pcre.h])
+- else
++ ], [
+ AC_MSG_ERROR([pcre-config not found, install the pcre-devel package or build with --without-pcre])
+- fi
++ ])
+ fi
+
+ AC_SUBST(PCRE_LIB)
diff --git a/yocto-poky/meta/recipes-extended/lighttpd/lighttpd_1.4.36.bb b/yocto-poky/meta/recipes-extended/lighttpd/lighttpd_1.4.36.bb
new file mode 100644
index 000000000..67b6e3749
--- /dev/null
+++ b/yocto-poky/meta/recipes-extended/lighttpd/lighttpd_1.4.36.bb
@@ -0,0 +1,77 @@
+SUMMARY = "Lightweight high-performance web server"
+HOMEPAGE = "http://www.lighttpd.net/"
+BUGTRACKER = "http://redmine.lighttpd.net/projects/lighttpd/issues"
+
+LICENSE = "BSD"
+LIC_FILES_CHKSUM = "file://COPYING;md5=e4dac5c6ab169aa212feb5028853a579"
+
+SECTION = "net"
+DEPENDS = "zlib libpcre"
+RDEPENDS_${PN} += " \
+ lighttpd-module-access \
+ lighttpd-module-accesslog \
+ lighttpd-module-indexfile \
+ lighttpd-module-dirlisting \
+ lighttpd-module-staticfile \
+"
+
+SRC_URI = "http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-${PV}.tar.xz \
+ file://index.html.lighttpd \
+ file://lighttpd.conf \
+ file://lighttpd \
+ file://lighttpd.service \
+ file://pkgconfig.patch \
+ file://0001-mod_cgi-buffers-data-without-bound.patch \
+ "
+
+SRC_URI[md5sum] = "1843daffcb018aa528f6d15d43544654"
+SRC_URI[sha256sum] = "897ab6b1cc7bd51671f8af759e7846245fbbca0685c30017e93a5882a9ac1a53"
+
+PACKAGECONFIG ??= "openssl"
+PACKAGECONFIG[openssl] = "--with-openssl, --without-openssl, openssl"
+
+EXTRA_OECONF = " \
+ --without-bzip2 \
+ --without-ldap \
+ --without-lua \
+ --without-memcache \
+ --with-pcre \
+ --without-webdav-props \
+ --without-webdav-locks \
+ --disable-static \
+"
+
+inherit autotools pkgconfig update-rc.d gettext systemd
+
+INITSCRIPT_NAME = "lighttpd"
+INITSCRIPT_PARAMS = "defaults 70"
+
+SYSTEMD_SERVICE_${PN} = "lighttpd.service"
+
+do_install_append() {
+ install -d ${D}${sysconfdir}/init.d ${D}${sysconfdir}/lighttpd.d ${D}/www/pages/dav
+ install -m 0755 ${WORKDIR}/lighttpd ${D}${sysconfdir}/init.d
+ install -m 0644 ${WORKDIR}/lighttpd.conf ${D}${sysconfdir}
+ install -m 0644 ${WORKDIR}/index.html.lighttpd ${D}/www/pages/index.html
+
+ install -d ${D}${systemd_unitdir}/system
+ install -m 0644 ${WORKDIR}/lighttpd.service ${D}${systemd_unitdir}/system
+ sed -i -e 's,@SBINDIR@,${sbindir},g' \
+ -e 's,@SYSCONFDIR@,${sysconfdir},g' \
+ -e 's,@BASE_BINDIR@,${base_bindir},g' \
+ ${D}${systemd_unitdir}/system/lighttpd.service
+ #For FHS compliance, create symbolic links to /var/log and /var/tmp for logs and temporary data
+ ln -sf ${localstatedir}/log ${D}/www/logs
+ ln -sf ${localstatedir}/tmp ${D}/www/var
+}
+
+FILES_${PN} += "${sysconfdir} /www"
+
+CONFFILES_${PN} = "${sysconfdir}/lighttpd.conf"
+
+PACKAGES_DYNAMIC += "^lighttpd-module-.*"
+
+python populate_packages_prepend () {
+ lighttpd_libdir = d.expand('${libdir}')
+ do_split_packages(d, lighttpd_libdir, '^mod_(.*)\.so$', 'lighttpd-module-%s', 'Lighttpd module for %s', extra_depends='')
+}