boa编译及研究

本文介绍boa的编译,以及其配置、运行。

一、准备工作

下载boa源码。地址:

1
http://www.boa.org/

文件名为boa-0.94.13.tar.gz,版本0.94.13,更新日期2005年。

安装flex和bison:

1
apt-get install -y flex bison

二、编译前准备

解压boa-0.94.13.tar.gz,得到boa-0.94.13目录。
修改src/compat.h文件,将

1
#define TIMEZONE_OFFSET(foo) foo##->tm_gmtoff

改为

1
#define TIMEZONE_OFFSET(foo) foo->tm_gmtoff

三、编译

1
2
3
cd src
./configure
make -j

将得到的boa和boa.conf拷贝到某个指定目录。如/home/latelee/project/boa_project/boa

四、配置

boa.conf修改:

1
2
3
4
5
#User nobody
#Group nogroup
# changed by Late Lee
User 0
Group 0

五、运行

1
./boa -c . -r .

六、排错

1
2
404 Not Found
The requested URL /cgi-bin/login.cgi was not found on this server.

->
在配置文件中设置:

1
ScriptAlias /cgi-bin/ /opt/app/boa/cgi-bin/

并且在html文件中也要写cgi-bin(注:前面不带“/”):

1
<form name="login" action="cgi-bin/login.cgi">
1
document open: No such file or directory

–> 忘记了

1
2
502 Bad Gateway
The CGI was not CGI/1.1 compliant.

–>有些html头不对造成。

1
cgi_header: unable to find LFLF
1
2
400 Bad Request
Your client has issued a malformed or illegal request.

–>查看boa错误日志文件,出现:Content-Length [24006664] > SinglePostLimit [1048576] on POST!
文件太大造成。