`

安装thttpd的手册

阅读更多

本手册是在新装的NetBSD上安装的。
(1) ftp上传thttpd-2.25b.tar.gz到/usr/src(可能可以是其他路径)
(2) tar –xzpvf thttpd-2.25b.tar.gz
(3) ./configure
(4) make
(5) make install
make install的时候会出现2个问题,导致make install失败。
① thttpd需要www的用户组,所以需要用groupadd www命令来生成www的用户组
② make install的时候会报没有/usr/local/man/man1的错误,所以要mkdir man1
以上就是thttpd的configure make和make install,相对来说比较简单。
以下就是配置thttpd的开机自启动和配置文件了,首先是配置文件。
(6) 配置文件如下所示:
dir=/usr/local/www/data
#chroot
cgipat=/cgi-bin/**.cgi
logfile=/usr/local/www/logs/thttpd.log
pidfile=/var/run/thttpd.pid

解释一下:
dir:就是cgi文件和html文件的所在之处。官方的解释是:
Data directory.
The config file specifies that the data directory is /usr/local/www/data; this is what Apache calls the DocumentRoot. So, create this directory and put your HTML files there. If you want to allow local users to put up there own web stuff, create subdirectories for them and chown/chmod them accordingly.
chroot:如果不注销的话,thttpd装好后在IE里访问的时候会出现/root路径下的目录,不知道为什么,这是事实,如果把它注销的话,就显示了/usr/local/www/data目录下的路径了。
cgi-bin:是将来我们放cgi文件的路径。
解释一下:我们通过IE能看到的是/usr/local/www/data,所以要明确的指出cgi文件的路径,还需要指明是/usr/local/www/data目录下cgi-bin下的**.cgi文件。
logfile和pidfile指定与不指定没什么关系,用处不是很大。
这样我们的配置文件就完成了。
(7) 下面是配置开机自启动了,这些跟一般的开机自启动一样配置。
在/etc/rc.conf中加入“thttpd=YES”,这里要注意,不能按照c/c++中的coding习惯写成
“thttpd = YES”,中间不能加空格。
在/etc/rc.d中加入script,具体做法是,拷贝一个rc.d里的简单的文件,把它转化为可读可写可执行的文件。然后vi它。修改为如下:
name="thttpd"
rcvar=$name
command="/usr/local/sbin/${name}"
command_conf="/usr/local/www/thttpd.conf"
${command}  -C ${command_conf}
run_rc_command "$1"
这个文件相对来说还是满简单的,可能还有更好的方法,不过这样写的话,重新启动后,就可以访问了。

分享到:
评论
1 楼 楚天阔 2011-02-25  
看来已经找到了哈

相关推荐

Global site tag (gtag.js) - Google Analytics