开发渠道:ubuntu 8.04
方针渠道:S3c2410
开发东西:arm 穿插东西链版别3.4.5
boa版别:boa-0.94.13.tar.gz
一、下载源码,生成makefile
1. 下载源码:
2. 仿制到 /opt 目录下
3.解压 tar zxvf boa-0.94.13.tar.tar
4.cd boa-0.94.13/src
5. ./configure
二、编译前,修正文件
1. 修正Makefile文件,找到CC=gcc和CPP=gcc -E,别离将其改为穿插编译器装置的途径:
CC= arm-softfloat-linux-gnu-gcc
CPP= arm-softfloat-linux-gnu-g++
保存退出。
2. 修正编译方法:
LDFLAGS = -g –static
注: 运用静态编译能够让方针文件主动的包括所需求的
库文件,而动态编译需求手艺仿制库文件。
3.修正/src/defines.h文件:
#define SERVER_ROOT “/etc/boa”
4 修正boa-0.94/src/ uTIl.c文件
修正char *get_commonlog_TIme(void)函数。
TIme_offset = 0;
5. 修正src/config.c:加Current_uid=1
6. 修正compat.h: 把第120 行的
#define
TIMEZONE_OFFSET(foo)foo##->tm_gmtoff
修正为:
#define
TIMEZONE_OFFSET(foo)foo->tm_gmtoff
7.修正/src/boa.c,注释掉下面两行:
/* if (setuid(0) != -1) {
DIE(“icky Linux kernel bug!”);
} */
/*if (passwdbuf == NULL) {
DIE(“getpwuid”);
}*/
8 :config.c
/*if (!server_name) {
struct hostent *he;
char temp_name[100];
if (gethostname(temp_name, 100) == -1) {
perror(“gethostname:”);
exit(1);
}
he = gethostbyname(temp_name);
if (he == NULL) {
perror(“gethostbyname:”);
exit(1);
}
server_name = strdup(he->h_name);
if (server_name == NULL) {
perror(“strdup:”);
exit(1);
}
}*/
9. /src/log.c中的修正:注释掉:
/* if (dup2(error_log, STDERR_FILENO) == -1) {
DIE(“unable to dup2 the error log”);
} */
10. 在boa.conf中的修正:
(1) ServerName的设置
修正#ServerName
为 ServerName
留意:该项默以为未翻开,履行Boa会反常退出,提示“gethostbyname::No such file or directory”,所以有必要翻开。其它默认设置即可。
留意:以下是为改为下面这样的:
(2)User与Group的修正:
User 0
Group 0
(3)ErrorLog /var/log/boa/error_log
AccessLog /var/log/boa/access_log
(4)DocumentRoot /var/www
(5)DirectoryIndex index.html
(6)KeepAliveMax 1000
KeepAliveTImeout 10
(7)MimeTypes /etc/mime.types
(8)ScriptAlias /cgi-bin/ /var/www/cgi-bin/
三、编译并移植
1.编译 boa
# make
# arm-softfloat-linux-gnu-strip boa
2,将mime.types文件仿制方针板根文件体系/etc目录下
3。在开发板上
cd /etc
mkdir boa
把开发机上的 (配置文件)boa.conf (编译成果)boa defines.h 这3个文件仿制到 开发板/etc/boa/ 下
4. 在开发板上
cd /var
mkdir www (这个文件夹内能够放网页)
mkdir /var/log/boa
四、 编写CGI脚本测验
1、编写Helloworld.c程序
int main(void)
{
printf(“Content-type:text/htmlnn”); //这句一定要加上
printf(” Hello,world.”);
exit(0);
}
arm-softfloat-linux-gnu-gcc -o helloworld helloworld.c
2、阅读
将helloworld仿制至/var/www/cgi-bin/下,阅读器输入开发板IP地址即可看到web信息。