news 2026/5/30 1:16:14

boa服务器的移植(包含Ubuntu和ARM板)

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
boa服务器的移植(包含Ubuntu和ARM板)

boa服务器的移植

Ubuntu端移植

1.源码下载:boa官网

2.解压文件,并进入./boa-0.94.13/src目录

tar-xvfboa-0.94.13.tar.gzcdboa-0.94.13/src

3.执行./configure配置编译环境

./configure

4.修改两处源码,以防编译报错,然后make
第一处:

tong@tong-virtual-machine:~/linux/tool/boa_server/boa-0.94.13/src$vicompat.h +120


将这一行改为:

#defineTIMEZONE_OFFSET(foo)(foo)->tm_gmtoff

第二处:

tong@tong-virtual-machine:~/linux/tool/boa_server/boa-0.94.13/src$viboa.c +225

注释如图所示的区域代码:

然后尝试下make

tong@tong-virtual-machine:~/linux/tool/boa_server/boa-0.94.13/src$make

5.创建boa的目录

tong@tong-virtual-machine:~$pwd/home/tong tong@tong-virtual-machine:~$mkdirboa tong@tong-virtual-machine:~$cdboa/ tong@tong-virtual-machine:~/boa$mkdircgi-bin www log

6.修改boa.conf配置文件

tong@tong-virtual-machine:~/linux/tool/boa_server/boa-0.94.13$viboa.conf

需要修改的部分如下:

Port80User0Group0ErrorLog /home/tong/boa/log/error_log AccessLog /home/tong/boa/log/access_log DocumentRoot /home/tong/boa/www UserDir public_html DirectoryIndex index.html DirectoryMaker /home/tong/boa/boa_indexer KeepAliveMax1000KeepAliveTimeout10MimeTypes /home/tong/boa/mime.types ScriptAlias /cgi-bin/ /home/tong/boa/cgi-bin/

7.修改defines.h配置文件

tong@tong-virtual-machine:~/linux/tool/boa_server/boa-0.94.13/src$pwd/home/tong/linux/tool/boa_server/boa-0.94.13/src tong@tong-virtual-machine:~/linux/tool/boa_server/boa-0.94.13/src$videfines.h +30


箭头处改成:

#defineSERVER_ROOT"/home/tong/boa"

8.编译

tong@tong-virtual-machine:~/linux/tool/boa_server/boa-0.94.13/src$makeclean tong@tong-virtual-machine:~/linux/tool/boa_server/boa-0.94.13/src$make

9.将编译得到的文件移动到你新创建的boa目录下

tong@tong-virtual-machine:~/linux/tool/boa_server/boa-0.94.13/src$sudocp/etc/mime.types /home/tong/boa/ tong@tong-virtual-machine:~/linux/tool/boa_server/boa-0.94.13/src$cpboa /home/tong/boa tong@tong-virtual-machine:~/linux/tool/boa_server/boa-0.94.13/src$cpboa_indexer /home/tong/boa tong@tong-virtual-machine:~/linux/tool/boa_server/boa-0.94.13/src$cp../boa.conf /home/tong/boa

10.实现CGI测试文件

tong@tong-virtual-machine:~/boa/cgi-bin$pwd/home/tong/boa/cgi-bin tong@tong-virtual-machine:~/boa/cgi-bin$touchtest.c tong@tong-virtual-machine:~/boa/cgi-bin$vitest.c tong@tong-virtual-machine:~/boa/cgi-bin$ gcc test.c-otest.cgi

test.c内容

#include<stdio.h>intmain(){printf("Content-type:text/html\n\n");//这句一定要加上printf("<html><body>");printf("<font style=\"color:red; font-size:30px;\">Hello, BOA server!</font><br/>");printf("<a href=\"/index.html\">return index.html</a>");printf("</body></html>");return0;}

11.实现HTML页面测试文件

tong@tong-virtual-machine:~/boa/www$pwd/home/tong/boa/www tong@tong-virtual-machine:~/boa/www$touchindex.html tong@tong-virtual-machine:~/boa/www$viindex.html

index.html内容

<html><body><h1>this is a boa server test!</h1><br/><imgsrc="image.jpg"/><h3>tree picture</h3><br/><ahref="/cgi-bin/test.cgi">to cgi page</a></body></html>

image.jpg 随便找一张图片,放在当前目录
注意image.jpg权限

tong@tong-virtual-machine:~/boa/www$chmod775image.jpg

然后到此位置移植完成,开始测试
12.测试

sudo./boa tong@tong-virtual-machine:~/boa$ps-ef|grepboa tong16451150018:58 ? 00:00:00 /usr/libexec/gsd-keyboard root83751150020:39 pts/0 00:00:00 ./boa tong83778027020:39 pts/0 00:00:00grep--color=auto boa

然后我们打开浏览器,输入127.0.0.1,然后测试网页.

到此Ubuntu端移植结束。

ARM端移植

ARM板以IMX6ULL型号为例子。这部分参考博客是boa服务器的移植
其中前三步与Ubuntu一致。在第4步中,额外注释以下内容。

然后在板子的目录下创建与Ubuntu中相同的文件夹

然后修改boa.conf配置文件,注意路径要和你板子boa路径一致。
需要修改的部分如下(基本与Ubuntu一样,只有一行新加):
ServerName 192.168.1.50板子IP地址,直接在最后一行加这行。

Port80User0Group0ErrorLog /home/tong/boa/log/error_log AccessLog /home/tong/boa/log/access_log DocumentRoot /home/tong/boa/www UserDir public_html DirectoryIndex index.html DirectoryMaker /home/tong/boa/boa_indexer KeepAliveMax1000KeepAliveTimeout10MimeTypes /home/tong/boa/mime.types ScriptAlias /cgi-bin/ /home/tong/boa/cgi-bin/ ServerName192.168.1.50

修改defines.h配置文件与Ubuntu步骤一样,注意地址要是板子实际文件地址。
然后修改MakeFile文件。
先查看交叉编译器是否存在:

tong@tong-virtual-machine:~/linux/tool/boa-0.94.13/src$ arm-linux-gnueabihf-gcc-v

然后打开Makefile

tong@tong-virtual-machine:~/linux/tool/boa-0.94.13/src$viMakefile

修改为如图所示:

然后make编译,剩下的步骤和Ubuntu上一致。注意网页上输入的是板子IP地址。

版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/5/30 1:16:14

云原生安全最佳实践:保护云原生应用和基础设施安全

云原生安全最佳实践&#xff1a;保护云原生应用和基础设施安全一、云原生安全最佳实践概述 1.1 云原生安全最佳实践的定义 云原生安全最佳实践是指在云原生环境中保护应用和基础设施安全的系统化方法和最佳实践集合。它涵盖从基础设施层到应用层的多层次安全防护&#xff0c;通…

作者头像 李华
网站建设 2026/5/30 1:11:07

我的Obsidian知识库,现在可以自动剪藏笔记到本地了

我用Obsidian大概两年了。跟大部分Obsidian用户一样&#xff0c;最开始被它的双向链接和知识图谱吸引&#xff0c;觉得这东西太适合做个人知识管理了。 但用了半年以后我发现一个问题&#xff0c;Obsidian本身只是一个容器&#xff0c;它不帮你生产内容。你的知识库能长多大&a…

作者头像 李华
网站建设 2026/5/30 1:10:10

AI动态简报之算力基建篇(2026.05.29)

2026年5月29日 关注GPU算力、AI芯片与云计算⚡ 01 | 英伟达发布Blackwell Ultra GPU&#xff0c;AI训练性能翻倍2026年5月21日GTC大会上&#xff0c;英伟达CEO黄仁勋正式发布新一代数据中心GPU Blackwell Ultra。该芯片在FP8精度下AI训练性能较上一代提升超过100%&#xff0c;…

作者头像 李华
网站建设 2026/5/30 1:09:16

告别风扇噪音与高温:FanControl三分钟搞定Windows散热优化

告别风扇噪音与高温&#xff1a;FanControl三分钟搞定Windows散热优化 【免费下载链接】FanControl.Releases This is the release repository for Fan Control, a highly customizable fan controlling software for Windows. 项目地址: https://gitcode.com/GitHub_Trendin…

作者头像 李华
网站建设 2026/5/30 1:09:11

基于Arduino与BNO055陀螺仪的桌面绘图机器人:从传感器融合到G代码解析

1. 项目概述&#xff1a;用陀螺仪“驯服”一台桌面绘图机器人几年前&#xff0c;当我第一次尝试用两个直流电机和一块Arduino板子做一台简单的绘图小车时&#xff0c;结果令人沮丧——画出来的直线像喝醉了酒&#xff0c;圆圈更是变成了多边形。问题的核心在于转向控制&#xf…

作者头像 李华
网站建设 2026/5/30 1:05:48

95、CAN FD的协议控制位详解:FDF、BRS与ESI的协同工作

CAN FD的协议控制位详解:FDF、BRS与ESI的协同工作 去年在调试某款车规级MCU的CAN FD通信时,遇到一个诡异现象:节点A发送的数据帧,节点B偶尔能收到,偶尔收不到,而且收不到的时候示波器上波形看起来完全正常。折腾了两天,最后发现是BRS位在作祟——节点B的收发器不支持CA…

作者头像 李华