compile-and-install-lighttpd.md
lighttpd
安裝相依套件
sudo apt-get install autoconf
sudo apt-get install automake
sudo apt-get install libtool
sudo apt-get install m4
sudo apt-get install pkg-config
sudo apt-get install libpcre2-dev
sudo apt-get install zlib1g-dev
抓取原始碼
git clone https://git.lighttpd.net/lighttpd/lighttpd1.4.git
cd lighttpd1.4
git pull
編譯及安裝
- In generic PC platform.
cd lighttpd1.4
./autogen.sh
./configure -C --prefix=/usr/local
make -j 32
sudo make install
- Cross-compiling with arm platform, add toolchain prefix(such as arm-linux) in configure stage.
./configure --build=arm-linux --host=x86_64-pc-linux-gnu --prefix=/usr/local --disable-static --enable-shared
執行及測試
- Create lighttpd.conf like following.
server.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:
echo "Hello World!" > /tmp/hello.txt
- Running lighttpd
lighttpd -D -f lighttpd.conf &
- Visit http://127.0.0.1:8080/hello.txt
FastCGI
Install build requires
sudo apt-get install gcc make m4 autoconf automake libtool
Build code
./autogen.sh
./configure
make
make install
Running sample code with lighttpd
- Create lighttpd.conf like following.
server.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
lighttpd -D -f lighttpd.conf &
- Visit http://127.0.0.1:8080/echo-x
沒有留言:
張貼留言