BOA 服务CGI功能最简单测试

在Ubuntu下Boa的测试

    1. 安装 apt-get install boa

    由于boa默认使用80,请注意是否已经有http服务使用

     2. 配置 ,使用默认配置即可,配置文件 /etc/boa/boa.conf

        html文件路径  /var/www/

        cgi-bin路径     /usr/lib/cgi-bin/

     3. 测试文件

         *********************************

         *index.html  存放到 /var/www/目录中,通过post方式提交用户名和密码到CGI中

         *********************************

 <html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <title>User Info</title></head>
 <body>
 <form name="form1" action="/cgi-bin/pass.cgi" method="POST">
 <table align="center">
 <tr><td align="center" colspan="2"></td></tr>
 <tr>
 <td align="right">Name</td>
 <td><input type="text" name="Username"></td>
 </tr>
 <tr>
 <td align="right">Password</td>
 <td><input type="password" name="Password"></td>
 </tr>
 <tr>
 <td><input type="submit" value="Submit"></td>
 <td><input type="reset" value="Cancel"></td>
 </tr>
 </table>
 </form>
 </body>
 

</html>

         *********************************

         *pass.cgi 存放到  /usr/lib/cgi-bin/目录中,直接脚步实现

         *********************************

#!/bin/sh
echo "Content-type:text/html"
echo
echo "<html><body>"
echo "Hello Boa Cgi"

read url
echo $url
echo "<pre>"
ls -l /bin/
echo "</pre>"
echo "</body><html>"

4. 一些说明

    在示例的cgi  C程序中一般为printf("Content-type:text/html\n\n"); 必须有两个\n

    转为echo脚本实现,echo后面默认有一个\n,再来个空的echo 就又是一个\n.


在arm的板子上实现,版本与ubuntu不同,配置和路径有点不同

        ****************************************

        */etc/boa/boa.conf

        *****************************************

Port 80
User root
Group root
ErrorLog /dev/console
AccessLog /dev/null
ServerName gzsd6410
DocumentRoot /www
DirectoryIndex index.html
KeepAliveMax 1000
KeepAliveTimeout 10
MimeTypes /etc/mime.types
DefaultType text/plain
CGIPath /bin:/usr/bin:/usr/local/bin
AddType application/x-httpd-cgi cgi


         *********************************

         *index.html  存放到 /www/目录中,通过post方式提交用户名和密码到CGI中,内容同上

         *********************************

         *********************************

         *pass.cgi 存放到  /www/cgi-bin/目录中,直接脚步实现,内容同上

         *********************************




 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值