1================================================================================
2 INSTALLATION
3================================================================================
4
5This guide describes installation of lighttpd both for Linux and mOS.
6For Linux, we also provide the patches for multi-threading and SO_REUSEPORT.
7For more detail, please look at the description below.
8Each version of lighttpd should be configured differently and then compiled.
9
10================================================================================
11 Original version
12================================================================================
13
14:author: Jan Kneschke
15:Date: $Date: $
16:Revision: $Revision: $
17
18Get the source from
19
20http://www.lighttpd.net/download/
21
22unpack it by ::
23
24  $ gzip -cd lighttpd-1.x.x.tar.gz | tar xf -
25
26compile and install it with ::
27
28  $ cd lighttpd-1.x.x
29  $ ./configure
30  $ make
31  $ su -
32  # make install (if necessary)
33  # exit
34
35take a look at the configfile in ./doc/lighttpd.conf,
36make your own copy of that file and modify it for your needs.
37
38================================================================================
39 mOS version
40================================================================================
41You may need to install the following packages to compile lighttpd:
42  - gcc (Ubuntu package: gcc)
43  - gdb (Ubuntu package: gdb)
44  - make (Ubuntu package: make)
45  - libpcre-dev (Ubuntu package: libpcre3-dev libpcre++-dev)
46
47
48Configure the program with the following arguments:
49
50  $ ./configure --without-bzip2 CFLAGS="-O3" \
51    --with-libmtcp=${PATH_TO_LIBMOS} \
52    --with-libdpdk=${PATH_TO_LIBDPDK}
53
54  (e.g.
55	$ ./configure --without-bzip2 CFLAGS="-g -O3" \
56	--with-libmtcp="<$PATH_TO_MOS>/core" \
57	--with-libdpdk=$RTE_SDK/$RTE_TARGET
58  )
59
60The path should be absolute.
61
62  ## For debugging
63  $ ./configure --without-bzip2 CFLAGS="-g -DINFO -DDBGERR" \
64    --with-libmtcp=${PATH_TO_LIBMOS} \
65    --with-libdpdk=${PATH_TO_LIBDPDK}
66
67  (e.g.
68	$ ./configure --without-bzip2 CFLAGS="-g -DINFO -DDBGERR" \
69	--with-libmtcp="<$PATH_TO_MOS>/core/" \
70	--with-libdpdk=$RTE_SDK/$RTE_TARGET
71  )
72
73Please remember to adjust lighttpd.conf file carefully.
74Fields to adjust are:
75  - server.bind
76  - server.event-handler
77  - server.network-backend
78  - server.listen-backlog
79  - server.document-root
80  - server.infinite-keep-alive-requests
81	-- set it to "enable" for better performance
82
83Also, remember to locate the 'mos.conf' at the directory where the binary lies.
84  -- This should be $<path_to_lighttpd>/src/mos.conf
85
86Sample lighttpd configuration files are placed at doc/config/. The default
87config file assumes that it host web pages in /srv/www/htdocs directory while
88it does error logging in /tmp/lighttpd/error.log file. Please make sure that
89the directories are created before running lighttpd.
90 - Default: lighttpd.conf
91 - For mOS: m-lighttpd.conf
92
93Please use the following command to run lighttpd:
94  $ sudo ./lighttpd -D -f ${PATH_TO_CONFIG_FILE} -n ${NO_OF_CORES}
95  (e.g., $ sudo ./lighttpd -D -f ../docs/config/m-lighttpd.conf -n 8)
96
97Both PATH_OF_CONFIG_FILE and NO_OF_CORES options are required.
98
99================================================================================
100 Multi-threaded version (on Linux)
101================================================================================
102
103Configure the program with the following arguments:
104
105  $ ./configure --without-bzip2 CFLAGS="-O3" --enable-multithreading
106
107Please remember to adjust lighttpd.conf file carefully.
108Fields to adjust are:
109  - server.bind
110  - server.event-handler ("linux-sysepoll")
111  - server.network-backend ("linux-sendfile")
112
113Please turn OFF server.listen-backlog
114
115A sample lighttpd.conf file is placed@: doc/config/lighttpd.conf
116
117Please use the following command to run lighttpd:
118  $ sudo ./src/lighttpd -D -f ${PATH_OF_CONFIG_FILE} -n ${NO_OF_CORES}
119
120================================================================================
121 Multi-threaded REUSEPORT version (on Linux)
122================================================================================
123
124First, check whether your kernel version is higher than 3.9. This SO_REUSEPORT
125option is supported only after Linux-3.9.
126
127Then, please check whether SO_REUSEPORT is defined. Please update
128/usr/include/asm-generic/socket.h by adding the following line.
129(if it is not already defined)
130
131#define SO_REUSEPORT 15
132
133
134Configure the program with the following arguments:
135
136  $ ./configure --without-bzip2 CFLAGS="-O3 -DREUSEPORT" --enable-multithreading
137
138Please remember to adjust lighttpd.conf file carefully.
139Fields to adjust are:
140  - server.bind
141  - server.event-handler ("linux-sysepoll")
142  - server.network-backend ("linux-sendfile")
143  - server.document-root
144
145Please turn OFF server.listen-backlog
146
147Please use the following command to run lighttpd:
148  $ sudo ./src/lighttpd -D -f ${PATH_OF_CONFIG_FILE} -n ${NO_OF_CORES}
149
150================================================================================
151
152                    Contact: mtcp at list.ndsl.kaist.edu
153                               April 2, 2014.
154              Muhammad Asim Jamshed <ajamshed at ndsl.kaist.edu>
155