boa服务器及cgic库的安装及使用

本文介绍如何从下载boa-0.94.13.tar.gz开始,逐步完成boa轻量级Web服务器的配置与优化过程,包括解决make过程中遇到的常见问题,并实现自动启动。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1 )在www.boa.org 下载boa-0.94.13.tar.gz 并解压
# tar -zxvf boa-0.94.13.tar.gz
2 )在src 目录下运行./configure
3 )生成Makefile 文件,修改
CC = arm-linux-gcc
CPP = arm-linux-gcc–E
(1) 将boa.c 文件中以下几行判断去掉即可。
if ( setuid ( 0 ) != - 1 ) { 
    DIE ( "icky Linux kernel bug!" ); 
}
(2)
修改文件compat.h   P120
#define TIMEZONE_OFFSET(foo) foo##->tm_gmtoff
修改成
#define TIMEZONE_OFFSET(foo) (foo)->tm_gmtoff
(3)
把src 文件夹下的config.c 里的if(!server_name){..........} (大概在266 行到286 行之间)注释掉
否则
Error :
./boa
gethostbyname:: Resource temporarily unavailable

(4) 修改 src/log.c
注释掉
if (dup2(error_log, STDERR_FILENO) == -1) {
DIE("unable to dup2 the error log");
}
否则会出现错误:
log.c:73 unable to dup2 the error log:bad file descriptor

//自己出现的问题

//错误1:

root@ubuntu:~/zy/php项目/boa-0.94.13/src# make
yacc  -d boa_grammar.y
make: yacc: Command not found
make: *** [y.tab.c] Error 127

解决方法:

root@ubuntu:~/zy/php项目/boa-0.94.13/src# apt-get install bison
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
  firefox-locale-zh-hant

。。。

//错误2:

root@ubuntu:~/zy/php项目/boa-0.94.13/src#  make
lex  boa_lexer.l
make: lex: Command not found
make: *** [lex.yy.c] Error 127

解决方法:

root@ubuntu:~/zy/php项目/boa-0.94.13/src# apt-get install flex

改变板子的属性,为可写:执行一个命令就可以变成可写的 好象是chmod 777

自动启动boa :在/etc/profile 中启动boa 即可

4 )make

 优化:
  #arm-linux-strip boa
  这里的优化就是去除 boa 中的调试信息。经过此操作,boa 会由 232K 变成 62K 左右,这个优化是比较常用的做法。



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值