Ubuntu14.04搭建Boa服务

1. 下载 boa 源码 : https://sourceforge.net/projects/boa/

   版本:boa-0.94.13.tar.gz

2. 在Ubuntu 下解压进入 【boa-0.094.13/src/】目录下

3. 执行命令 【./configure】-----> 【make

提示错误:

    yacc -d boa_grammar.y

          make: yacc:命令未找到

          make: *** [y.tab.c] 错误 127

解决方式:缺少bison 库 :【sudo apt-get install bison

4. 继续执行【make】 

提示错误:

    lex boa_lexer.l

     make: lex: 命令未找到

     make: *** [lex.yy.c] 错误 127

解决方式:【 sudo apt-get install flex 

5. 继续执行【make】

提示错误:

     util.c:100:39error: pasting "t" and "->" does not give a valid preprocessing token

               time_offset = TIMEZONE_OFFSET(t);

     compat.h: 120:30: note: in definition of macro 'TIMEZONE_OFFSET'

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

解决方式:修改 boa-0.94.13/src/compat.h 文件中的120行 如下:【 #define TIMEZONE_OFFSET(foo)  foo->tm_gmtoff 

 

6. 继续执行:【make】 ok

上面已经初步编译成功,开始对boa 进行配置

 

7. 【 sudo mkdir /etc/boa

 【 cp boa-0.94.13/boa.conf   /etc/boa/

 

  (1) 将 【 /etc/boa/boa.conf 】文件修改如下:

将:
User nobody
Group nogroup
改为:
User 0
Group 0

  

  (2)修改第2处

将:
#ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
改为如下:
ScriptAlias /cgi-bin/ /var/www/htbin/ 

  

 

 8. 创建必要的目录

 【 sudo mkdir /var/www

 【 sudo mkdir /var/www/cgi-bin

 【 sudo mkdir /var/log/boa

9. 在 【 /var/www/ 】下创建测试的html 文件 【index.html】

 

<html>
<body>
<p> Turn on/off Led </p>
<button type="button" id="led_on"> turn on </button>
<br/>
<br/>
<button type="button" id="led_off"> turn off </button>
</body>
</html>

 

 

 

10. 在目录【 boa-0.94.13/src】 下执行 【sudo ./boa】启动 boa服务

  (1)提示错误:

 

   log.c:73 - unable to dup2 the error log: Bad file descriptor

 

解决方式:注释掉 boa-094.13/src/log.c 中

/*    
 if (dup2(error_log, STDERR_FILENO) == -1) {
       DIE("unable to dup2 the error log");
 }
*/ 

重新 编译 make , 再次执行 sudo ./boa

  (2)提示错误   

     boa.c: 226 - icky Linux kernel bug!: Success

 解决方式:注释掉 boa.c中的

/* if (setuid(0) != -1) {
       DIE(”icky Linux kernel bug!”);
} */

 

重新编译,并启动boa服务,成功启动!

 12.  再次启动boa服务 【 sudo ./boa 】并打开浏览器 输入 127.0.0.1

 

 

 

转:https://blog.csdn.net/crazy0126/article/details/41223103

posted on 2019-07-18 18:06  管理员D  阅读(520)  评论(0编辑  收藏  举报

导航