要 survey 可以替代 thttpd 的東東, 照慣例, 先把 source code 放在 ubuntu 上試試看.

第一部份是安裝, 第二部份是 run 一個的 index.html.

先 download 最新的 source (我裝的是 1.4.33)

http://www.lighttpd.net/download/

 

安裝: 

1. ./configure --prefix=/usr/local/lighttpd

出現 configure: error: bzip2-headers and/or libs where not found, install them or build with --without-bzip2

安裝 bzip2 相關:  apt-get install libbz2-dev

再做一次  ./configure --prefix=/usr/local/lighttpd, 成功

 

2. make 

 

3. make install

 

至此, lighttpd 編譯安裝完成.

位置就在 /usr/local/lighttpd

*************************************************************************

運作:

1. 在 /usr/local/lighttpd/sbin/ 新增一個 lighttpd.conf

內容:

server.document-root="/usr/local/lighttpd/www/"
server.port=8888
server.username="www-data"
server.groupname="www-data"
mimetype.assign=(
".html"=>"text/html",
".txt"=>"text/plain",
".jpg"=>"image/jpeg",
".png"=>"image/png"
)

static-file.exclude-extensions=(".fcgi",".php",".rb","~",".inc")
index-file.names=("index.html")

 

2. 在 /usr/local/lighttpd/www/ 新增一個 index.html

就直接拿 lighttpd 的 example 吧 !

example 位於 lighttpd-1.4.33/tests/docroot/www/ 

 

3. 回到 /usr/local/lighttpd/sbin/, 測試: 

lighttpd -D -f ./lighttpd.conf

其中, -D 意指 "非背景執行", 測試專用.

 

輸入後, 按 enter, 看到了似乎是正確的訊息 ...

2014-01-07 09:56:56: (log.c.166) server started

 

4. 使用 browser 連上 http://127.0.0.1:8888

秀出 index.html 的內容, 成功 !

 

5. 結束執行, 改輸入:

lighttpd  -f ./lighttpd.conf

至此, lighttpd 已經背景執行 !

 

**********************************

補充:

1. 重開 lighttpd: 

/etc/init.d/lighttpd restart 

 

參考:

http://wiki.dreamhost.com/Lighttpd_From_Source

http://fosswire.com/post/2007/09/installing-lighttpd-from-source-on-linux/

http://fwengineer.blogspot.tw/2013/05/linux-lighttpd.html

http://blog.yam.com/hn12303158/article/49748010

http://ubuntuforums.org/showthread.php?t=1544980 

 

 

 

 

 

 

 

 

arrow
arrow
    全站熱搜

    kk 發表在 痞客邦 留言(0) 人氣()