注:环境 thttpd ,嵌入式环境 1.thttpd.conf # This section overrides defaults dir=/tmp/www/ #指明WebServer 存放网页的根目录路径 port=9000 cgipat=/cgi-bin/* #以dir指定目录为根目录 #chroot #注释掉才可以运行使用动态链接库的cgi user=root # 以root 身份运 logfile=/etc/thttpd/log/thttpd.log # 日志文件路径 可以省略 pidfile=/etc/thttpd/run/thttpd.pid #pid 文件路径 可以省略 2.thttpd -C thttpd.conf #启用服务 3.不论是html 还是cgi-bin 中的cgi ,权限全部为777 最好,只加x执行权也可以 4.在用c语言写的cgi源程序中,牵扯到系统调用的system(), 所有的命令最好写绝对路径 例如touch ----> /bin/touch 因为/usr/bin /usr/sbin/ 下的命令如果不写绝对路径,不会执行。 5.总结:a.服务配置 b.文件权限 c.调用命令的全路径 三个方面可以搞定cgi出现的问题
|
|