lighttpd
安裝相依套件
1 | sudo apt-get install autoconf |
抓取原始碼
1 | git clone https://git.lighttpd.net/lighttpd/lighttpd1.4.git |
編譯及安裝
- In generic PC platform.
1
2
3
4
5cd lighttpd1.4
./autogen.sh
./configure -C --prefix=/usr/local # ./configure --help for additional options
make -j 32
sudo make install - Cross-compiling with arm platform, add toolchain prefix(such as arm-linux) in configure stage.
1
./configure --build=arm-linux --host=x86_64-pc-linux-gnu --prefix=/usr/local --disable-static --enable-shared
執行及測試
Create lighttpd.conf like following.
1
2
3
4server.document-root = "/tmp"
server.bind = "127.0.0.1"
server.port = 8080
mimetype.assign = (".txt" => "text/plain", ".html" => "text/html" )Create a simple file to serve:
1
echo "Hello World!" > /tmp/hello.txt
Running lighttpd
1 | lighttpd -D -f lighttpd.conf & #Run in background |
FastCGI
Install build requires
1 | sudo apt-get install gcc make m4 autoconf automake libtool |
Build code
1 | ./autogen.sh |
Running sample code with lighttpd
- Create lighttpd.conf like following.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27server.document-root = "/tmp"
server.bind = "127.0.0.1"
server.port = 8080
mimetype.assign = (".txt" => "text/plain", ".html" => "text/html" )
server.modules += ( "mod_fastcgi" )
fastcgi.debug = 1
fastcgi.server = (
"/echo-x" => ((
"bin-path" => "/home/jeff/fcgi2/examples/echo-x",
"socket" => "/tmp/echo-x.sock",
"check-local" => "disable",
"max-procs" => 2,
))
) - Running lighttpd
1
lighttpd -D -f lighttpd.conf & #Run in background
- Visit http://127.0.0.1:8080/echo-x