转载自https://www.cnblogs.com/EmbeddedGeorge/p/12371984.html,这里用作记录备份。
搭建好的boa源码https://download.youkuaiyun.com/download/gpio_01/15739094
修改源码
位置 src/defines.h
#define SERVER_ROOT "/home/george/boa" //此处为boa服务器位置,根据自己设置的位置填写正确
配置编译选项
./configure
如果无法执行,请修改 configure 文件的权限为755
编译源码
make clean //编译前先清理以下
make //编译
配置boa服务器
创建放置boa服务器的位置。(本文放在用户的根目录下)
mkdir -p ~/boa ~/boa/www ~/boa/cgi-bin ~/boa/log
拷贝安装相关文件
cp src/boa src/boa_indexer examples/boa.conf ~/boa
cp /etc/mime.types
修改配置文件 boa.conf
Port 80
User 0
Group 0
ErrorLog /home/george/boa/log/error_log
AccessLog /home/george/boa/log/access_log
DocumentRoot /home/george/boa/www
UserDir public_html
DirectoryIndex index.html
DirectoryMaker /home/george/boa/boa_indexer
KeepAliveMax 1000
KeepAliveTimeout 10
MimeTypes /home/george/boa/mime.types
DefaultType text/plain
CGIPath /bin:/usr/bin:/usr/local/bin
Alias /doc /usr/doc
ScriptAlias /cgi-bin/ /home/george/boa/cgi-bin/
至此,即完成了boa 服务器的移植。
测试boa服务器index.html#
<html>
<body>
<h3>This is a test page!</h3><br/>
<style>
img{
width:auto;
height:auto;
max-width:100%;
max-height:100%;
}
</style>
<img src="image.jpg"/>
<h3>Tree picture</h3><br/>
<a href="/cgi-bin/test.cgi">to cgi page</a>
</body>
</html>