176404edcSAsim Jamshed================================================================================ 276404edcSAsim Jamshed INSTALLATION 376404edcSAsim Jamshed================================================================================ 476404edcSAsim Jamshed 576404edcSAsim JamshedThis guide describes installation of lighttpd both for Linux and mOS. 676404edcSAsim JamshedFor Linux, we also provide the patches for multi-threading and SO_REUSEPORT. 776404edcSAsim JamshedFor more detail, please look at the description below. 876404edcSAsim JamshedEach version of lighttpd should be configured differently and then compiled. 976404edcSAsim Jamshed 1076404edcSAsim Jamshed================================================================================ 1176404edcSAsim Jamshed Original version 1276404edcSAsim Jamshed================================================================================ 1376404edcSAsim Jamshed 1476404edcSAsim Jamshed:author: Jan Kneschke 1576404edcSAsim Jamshed:Date: $Date: $ 1676404edcSAsim Jamshed:Revision: $Revision: $ 1776404edcSAsim Jamshed 1876404edcSAsim JamshedGet the source from 1976404edcSAsim Jamshed 2076404edcSAsim Jamshedhttp://www.lighttpd.net/download/ 2176404edcSAsim Jamshed 2276404edcSAsim Jamshedunpack it by :: 2376404edcSAsim Jamshed 2476404edcSAsim Jamshed $ gzip -cd lighttpd-1.x.x.tar.gz | tar xf - 2576404edcSAsim Jamshed 2676404edcSAsim Jamshedcompile and install it with :: 2776404edcSAsim Jamshed 2876404edcSAsim Jamshed $ cd lighttpd-1.x.x 2976404edcSAsim Jamshed $ ./configure 3076404edcSAsim Jamshed $ make 3176404edcSAsim Jamshed $ su - 3276404edcSAsim Jamshed # make install (if necessary) 3376404edcSAsim Jamshed # exit 3476404edcSAsim Jamshed 3576404edcSAsim Jamshedtake a look at the configfile in ./doc/lighttpd.conf, 3676404edcSAsim Jamshedmake your own copy of that file and modify it for your needs. 3776404edcSAsim Jamshed 3876404edcSAsim Jamshed================================================================================ 3976404edcSAsim Jamshed mOS version 4076404edcSAsim Jamshed================================================================================ 4176404edcSAsim JamshedYou may need to install the following packages to compile lighttpd: 4276404edcSAsim Jamshed - gcc (Ubuntu package: gcc) 4376404edcSAsim Jamshed - gdb (Ubuntu package: gdb) 4476404edcSAsim Jamshed - make (Ubuntu package: make) 4576404edcSAsim Jamshed - libpcre-dev (Ubuntu package: libpcre3-dev libpcre++-dev) 4676404edcSAsim Jamshed 4776404edcSAsim Jamshed 4876404edcSAsim JamshedConfigure the program with the following arguments: 4976404edcSAsim Jamshed 5076404edcSAsim Jamshed $ ./configure --without-bzip2 CFLAGS="-O3" \ 5176404edcSAsim Jamshed --with-libmtcp=${PATH_TO_LIBMOS} \ 52d270d183SAsim Jamshed --with-libdpdk=${PATH_TO_LIBDPDK} 5376404edcSAsim Jamshed 5476404edcSAsim Jamshed (e.g. 5576404edcSAsim Jamshed $ ./configure --without-bzip2 CFLAGS="-g -O3" \ 5676404edcSAsim Jamshed --with-libmtcp="<$PATH_TO_MOS>/core" \ 57d270d183SAsim Jamshed --with-libdpdk=$RTE_SDK/$RTE_TARGET 5876404edcSAsim Jamshed ) 5976404edcSAsim Jamshed 6076404edcSAsim JamshedThe path should be absolute. 6176404edcSAsim Jamshed 6276404edcSAsim Jamshed ## For debugging 6376404edcSAsim Jamshed $ ./configure --without-bzip2 CFLAGS="-g -DINFO -DDBGERR" \ 6476404edcSAsim Jamshed --with-libmtcp=${PATH_TO_LIBMOS} \ 65d270d183SAsim Jamshed --with-libdpdk=${PATH_TO_LIBDPDK} 6676404edcSAsim Jamshed 6776404edcSAsim Jamshed (e.g. 6876404edcSAsim Jamshed $ ./configure --without-bzip2 CFLAGS="-g -DINFO -DDBGERR" \ 6976404edcSAsim Jamshed --with-libmtcp="<$PATH_TO_MOS>/core/" \ 70d270d183SAsim Jamshed --with-libdpdk=$RTE_SDK/$RTE_TARGET 7176404edcSAsim Jamshed ) 7276404edcSAsim Jamshed 7376404edcSAsim JamshedPlease remember to adjust lighttpd.conf file carefully. 7476404edcSAsim JamshedFields to adjust are: 7576404edcSAsim Jamshed - server.bind 7676404edcSAsim Jamshed - server.event-handler 7776404edcSAsim Jamshed - server.network-backend 7876404edcSAsim Jamshed - server.listen-backlog 7976404edcSAsim Jamshed - server.document-root 8076404edcSAsim Jamshed - server.infinite-keep-alive-requests 8176404edcSAsim Jamshed -- set it to "enable" for better performance 8276404edcSAsim Jamshed 8376404edcSAsim JamshedAlso, remember to locate the 'mos.conf' at the directory where the binary lies. 8476404edcSAsim Jamshed -- This should be $<path_to_lighttpd>/src/mos.conf 8576404edcSAsim Jamshed 8676404edcSAsim JamshedSample lighttpd configuration files are placed at doc/config/. The default 8776404edcSAsim Jamshedconfig file assumes that it host web pages in /srv/www/htdocs directory while 8876404edcSAsim Jamshedit does error logging in /tmp/lighttpd/error.log file. Please make sure that 8976404edcSAsim Jamshedthe directories are created before running lighttpd. 9076404edcSAsim Jamshed - Default: lighttpd.conf 9176404edcSAsim Jamshed - For mOS: m-lighttpd.conf 9276404edcSAsim Jamshed 9376404edcSAsim JamshedPlease use the following command to run lighttpd: 9476404edcSAsim Jamshed $ sudo ./lighttpd -D -f ${PATH_TO_CONFIG_FILE} -n ${NO_OF_CORES} 9576404edcSAsim Jamshed (e.g., $ sudo ./lighttpd -D -f ../docs/config/m-lighttpd.conf -n 8) 9676404edcSAsim Jamshed 9776404edcSAsim JamshedBoth PATH_OF_CONFIG_FILE and NO_OF_CORES options are required. 9876404edcSAsim Jamshed 9976404edcSAsim Jamshed================================================================================ 10076404edcSAsim Jamshed Multi-threaded version (on Linux) 10176404edcSAsim Jamshed================================================================================ 10276404edcSAsim Jamshed 10376404edcSAsim JamshedConfigure the program with the following arguments: 10476404edcSAsim Jamshed 10576404edcSAsim Jamshed $ ./configure --without-bzip2 CFLAGS="-O3" --enable-multithreading 10676404edcSAsim Jamshed 10776404edcSAsim JamshedPlease remember to adjust lighttpd.conf file carefully. 10876404edcSAsim JamshedFields to adjust are: 10976404edcSAsim Jamshed - server.bind 11076404edcSAsim Jamshed - server.event-handler ("linux-sysepoll") 11176404edcSAsim Jamshed - server.network-backend ("linux-sendfile") 11276404edcSAsim Jamshed 11376404edcSAsim JamshedPlease turn OFF server.listen-backlog 11476404edcSAsim Jamshed 11576404edcSAsim JamshedA sample lighttpd.conf file is placed@: doc/config/lighttpd.conf 11676404edcSAsim Jamshed 11776404edcSAsim JamshedPlease use the following command to run lighttpd: 11876404edcSAsim Jamshed $ sudo ./src/lighttpd -D -f ${PATH_OF_CONFIG_FILE} -n ${NO_OF_CORES} 11976404edcSAsim Jamshed 12076404edcSAsim Jamshed================================================================================ 12176404edcSAsim Jamshed Multi-threaded REUSEPORT version (on Linux) 12276404edcSAsim Jamshed================================================================================ 12376404edcSAsim Jamshed 12476404edcSAsim JamshedFirst, check whether your kernel version is higher than 3.9. This SO_REUSEPORT 12576404edcSAsim Jamshedoption is supported only after Linux-3.9. 12676404edcSAsim Jamshed 12776404edcSAsim JamshedThen, please check whether SO_REUSEPORT is defined. Please update 12876404edcSAsim Jamshed/usr/include/asm-generic/socket.h by adding the following line. 12976404edcSAsim Jamshed(if it is not already defined) 13076404edcSAsim Jamshed 13176404edcSAsim Jamshed#define SO_REUSEPORT 15 13276404edcSAsim Jamshed 13376404edcSAsim Jamshed 13476404edcSAsim JamshedConfigure the program with the following arguments: 13576404edcSAsim Jamshed 13676404edcSAsim Jamshed $ ./configure --without-bzip2 CFLAGS="-O3 -DREUSEPORT" --enable-multithreading 13776404edcSAsim Jamshed 13876404edcSAsim JamshedPlease remember to adjust lighttpd.conf file carefully. 13976404edcSAsim JamshedFields to adjust are: 14076404edcSAsim Jamshed - server.bind 14176404edcSAsim Jamshed - server.event-handler ("linux-sysepoll") 14276404edcSAsim Jamshed - server.network-backend ("linux-sendfile") 14376404edcSAsim Jamshed - server.document-root 14476404edcSAsim Jamshed 14576404edcSAsim JamshedPlease turn OFF server.listen-backlog 14676404edcSAsim Jamshed 14776404edcSAsim JamshedPlease use the following command to run lighttpd: 14876404edcSAsim Jamshed $ sudo ./src/lighttpd -D -f ${PATH_OF_CONFIG_FILE} -n ${NO_OF_CORES} 14976404edcSAsim Jamshed 15076404edcSAsim Jamshed================================================================================ 15176404edcSAsim Jamshed 15276404edcSAsim Jamshed Contact: mtcp at list.ndsl.kaist.edu 15376404edcSAsim Jamshed April 2, 2014. 15476404edcSAsim Jamshed Muhammad Asim Jamshed <ajamshed at ndsl.kaist.edu> 155