从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>

Logo

更多推荐