thttpd是個小型的web服務器。是移植到arm的不錯選擇,今天配置了一下,其中遇到了一些問題。當自己做個備份,也分享一下自己的配置經驗吧。
CC=arm-linux-gcc ./configure --host=arm-linux-gcc
vi Makefile
/*指定靜態編譯,就可以省去動態庫的移動*/
LDFLAGS= -staticmake LDFLAGS="-static"
cp thttpd /usr/sbin(可以直接使用thttpd命令)
vi thttpd/contrib/redhat-rpm/thttpd.conf
/*-----修改內容如下------*/
dir=/etc/thttpd/html
#指明 WebServer 存放網頁的根目錄路徑
chroot
user=root
#以 root 身份運行 thttpd
logfile=/etc/thttpd/log/thttpd.log #日誌文件路徑
pidfile=/etc/thttpd/run/thttpd.pid #pid 文件路徑
/*其中這些變量的設置因實際情況而定*/
cp thttpd/contrib/redhat-rpm/thttpd.conf /etc
cd /home( 開發板上的目錄 )
mkdir thttpd
cd thttpd
mkdir html
(有個index.html文件)
mkdir log
(thttpd.log)//空文件
mkdir run
(thttpd.pid)//空文件
放置一個index.html文件到html裏面
測試:
# thttpd -C /etc/thttpd.conf然後用打開瀏覽器,輸入開發板ip即可訪問。
如果遇到./thttpd: unknown user - 'root'的問題,請檢查thttpd.conf文件。