- 论坛徽章:
- 0
|
1、从www.boa.org上下载源代码
$ cd ~/arm/source/boa
$ wget -c http://www.boa.org/boa-0.94.13.tar.gz
2、编译运行
$ tar zxf boa-0.94.13.tar.gz
$ cd boa-0.94.13/
$ cd src
$ ./configure
修改Makefile:
CC = arm-linux-gcc
CPP = arm-linux-gcc -E
现在开始编译:
$ make
这时候出现了没有yacc和lex的错误,需要安装一下, ubuntu下对应为bison和flex:
$ sudo apt-get install bison flex
注: bison-- A parser generator that is compatible with YACC
然后再次编译:
$ make
util.c:100:1: pasting "t" and "->" does not give a valid preprocessing token
make: *** [util.o] 错误 1
解决办法:
修改 src目录下 compat.h 中:
#define TIMEZONE_OFFSET(foo) foo##->tm_gmtoff 为:
#define TIMEZONE_OFFSET(foo) (foo)->tm_gmtoff
然后重新编译一下:
$ make clean; make
strip一下目标文件:
$ arm-linux-strip boa
3. boa的配置
Boa需要在/etc目录下建立一个boa目录,里面放入Boa的主要配置文件
boa.conf。在Boa源码目录下已有一个示例boa.conf,可以在其基础上进行修改:
1)确保passwd中有nobody用户,group中有nogroup组, 否则要将: Group nogroup 改为 Group
0, User nobody 改为User 0
其他的配置选项如下:
ServerName www.your.org.here
#AccessLog /var/log/boa/access_log
#ErrorLog /var/log/boa/error_log
DirectoryMaker /web/lib/boa_indexer
ScriptAlias /cgi-bin/ /web/cgi-bin/
其余的用默认吧。
2)mkdir /web;cd web;
mkdir cgi-bin lib html
然后将boa/src目下的boa_indexer拷贝到/web/lib下.
同时从host上拷贝/etc/mime.types 到目标板上的/etc目下。
4. Boa 测试:
1)html
$ cat web/html/index.html
srp-boa test
Hello, I am from boa!
Great Linux!!
sh cgi test
c cgi test
2) cgi
$ cat web/cgi-bin/sh.cgi
#!/bin/sh
echo "Content-type: text/html"
echo
echo
echo "shell test"
echo ""
echo "hello, this is the output from shell"
echo "
done!"
echo ""
$ cat test.c
#include
#include
int main(void)
{
printf("Content-type: text/html\n\n");
printf("\n");
printf("CGI Output\n");
printf("\n");
printf("Hello,This is the cgi-script\n");
printf("\n");
printf("\n");
exit(0);
}
arm-linux-gcc -o c.cgi test.c
将sh.cgi和c.cgi拷贝到目标板/web/cgi-bin/下
测试: http://192.168.0.34
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/56406/showart_1157848.html |
|