移植 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>

</head>

<body>


<title> Welcome to here^^ </title>

<marquee>

<font color=red>

Welcome to here^^!!!

</body>

</html>

</font>

</marquee>

猜你喜欢

转载自www.cnblogs.com/fanweisheng/p/11105678.html