本帖最后由 yidehui 于 2013-9-3 13:55 编辑
这几天在2440上移植了BOA,目前使用HTML编写网页,使用c语言编写cgi程序,用nfs挂载,使用浏览器可以正常访问了网页。
我的cgi程序放置的目录:/var/www/cgi-bin/
网页放置的目录:/var/www/
但是我把c语言改换成bash脚本之后就不行了,我只是想在网页上显示几行字而已啊!
编写的bash脚本------abc.sh
#!/bin/bash
echo "Content-type: text/html\n\n"
echo ""
echo "hello world"
其中abc.sh脚本我经过了以下两条命令的处理:
chmod 777 abc.sh
dos2unix abc.sh
abc.sh的存放路径跟c语言编写的cgi程序的路径一样!
而网页abc.html 的代码如下:
测试网页截图如下所示:
但是当我点击确定按钮是却显示
同时2440串口输出 [01/Jan/1970:00:33:07 +0000] cgi_header: unable to find LFLF
这是我的boa.conf,不知道如果改用bash的话,是不是要进行另外设置,这里先给出来。
Port 80
User 0
Group 0
ErrorLog /var/log/boa/error_log
AccessLog /var/log/boa/access_log
ServerName weibo.com
DocumentRoot /var/www
UserDir public_html
DirectoryIndex index.html
DirectoryMaker /usr/lib/boa/boa_indexer
KeepAliveMax 1000
KeepAliveTimeout 10
MimeTypes /etc/mime.types
DefaultType text/plain
CGIPath /bin:/usr/bin:/usr/local/bin
Alias /doc /usr/doc
#ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
ScriptAlias /cgi-bin/ /var/www/cgi-bin/
我现在很无语啊!用c语言可以,但是用bash编程却不可以!大家给点思路啊!