欢迎访问 生活随笔!

生活随笔

当前位置: 首页 >

移植 thttpd Web服务器

发布时间:2023/11/27 45 豆豆
生活随笔 收集整理的这篇文章主要介绍了 移植 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服务器的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。