移植 thttpd Web服务器
從http://www.acme.com/software/thttpd/ 下載thttpd 到/tmp 目錄當中,并解壓.
編譯thttpd
[arm@localhost thttpd-2.25b]$ CC=arm-linux-gcc ./configure --host=arm-linux
[arm@localhost thttpd-2.25b]$ vi Makefile
指定靜態鏈接二進制文件
LDFLAGS =?????? -static
[arm@localhost thttpd-2.25b]$ make LDFLAGS="-static"
配置
拷貝 thttpd二進制可執行文件到根文件系統/ usr/sbin/ 目錄中
[arm@localhost thttpd-2.25b]$ cp thttpd /home/arm/dev_home/rootfs/my_rootfs/usr/sbin/
修改 thttpd配置文件
[arm@localhost thttpd-2.25b]$ vi contrib/redhat-rpm/thttpd.conf
# This section overrides defaults
dir=/etc/thttpd/html??????????? #指明WebServer 存放網頁的根目錄路徑
chroot
user=root?????????????????????? # 以root 身份運?????? thttpd
logfile=/etc/thttpd/log/thttpd.log # 日志文件路徑
pidfile=/etc/thttpd/run/thttpd.pid #pid 文件路徑
拷貝thttpd.conf 配置文件到根文件系統的mnt/etc/ 目錄,
系統加載后,linuxrc 腳本會自動將mnt/etc/下的所有文件拷貝到/etc 目錄中。
[arm@localhost thttpd-2.25b]$ cp contrib/redhat-rpm/thttpd.conf /home/arm/dev_home/rootfs/my_rootfs/mnt/etc/
轉移到根文件系統目錄,創建相應的文件
[arm@localhost etc]$ cd /home/arm/dev_home/rootfs/my_rootfs
[arm@localhost my_rootfs]$ cd mnt/etc/
創建thttpd 目錄
[arm@localhost etc]$ mkdir thttpd
[arm@localhost etc]$ cd thttpd
thttpd 目錄下的目錄結構
|-- html
| `-- index.html Web Server 網頁根目錄下的默認HTML 文件
|-- log
| `-- thttpd.log 創建一個空文件就可
`-- run
??? `-- thttpd.pid 創建一個空文件就可
html 目錄下的index.html 文件內容如下:
<html>
<head>
??????? <title> Welcome to here^^ </title>
</head>
<body>
??????? <marquee>
??????????????? <font color=red>
??????????????????????? Welcome to here^^!!!
??????????????? </font>
??????? </marquee>
</body>
</html>
總結
以上是生活随笔為你收集整理的移植 thttpd Web服务器的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 第三者险多少钱啊?
- 下一篇: 服务器端开发经验总结 Linux C语言