本文主要是介绍thttpd的移植与注意事项,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1.官网下载
最好下载自己熟悉的版本
2.解压
tar -zxvf thttpd-2.25b.tar.gz
3. ./configure
注意./configure --host=编译链前缀,指定交叉编译链并不能改变Makefile中的编译链,
所以直接./configure
4.修改Makefile
修改三个Makefile,分别是thttpd/Makefile
、thttpd/cgi-src/Makefile
、thttpd/extras/Makefile
vi Makefile
CC = gcc
-> CC=arm-linux-gcc
,将gcc前缀修改为自己编译链的前缀
5.make
6.cp目标文件到目标文件系统
cp thttpd/thttpd /sbin/
拷贝thttpd到目标文件系统/bin下
cp thttpd/contrib/redhat-rpm/thttpd.conf /etc/
拷贝配置文件到目标系统/etc下
mkdir -p /opt/www/cgi-bin
chmod 755 /opt/www
创建存放网页的目录,权限指定为755
cp thttpd/index.html /opt/www/
拷贝demon网页到www目录
7.修改conf文件
# This section overrides defaults
dir=/opt/www#chroot
user=root
logfile=/etc/thttpd/thttpd.log
pidfile=/etc/thttpd/thttpd.pid
cgipat=/cgi-bin/*.cgi
# This section _documents_ defaults in effect
# port=80
# nosymlink# default = !chroot
# novhost
# nocgipat
# nothrottles
# host=0.0.0.0
# charset=iso-8859-1
注意:一定要注释掉chroot,chroot会限制cgi程序的访问路径,也就是只能访问/opt/www下的文件,包括程序的动态链接库,cgi程序必须静态编译才能运行,脚本等语言都不能运行
8.运行
thttpd -D -C /etc/thttpd.conf &
9.加入开机自启动
根据不同文件系统,设置不一样。
这篇关于thttpd的移植与注意事项的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!