这里写自定义目录标题
OK6410的Boa服务器移植:
<一> Boa的编译
-
从 www.boa.org 下载 Boa 服务器的最新版:boa-0.94.13.tar.gz。
-
解压:tar xzf boa-0.94.13.tar.gz
-
进入解压后的文件夹 boa-0.94.13内部的 src文件夹,对源文件进行如下修改
-
然后生成Makefile:./configure
-
修改生成的Makefile:默认生成的Makefile针对x86平台,我们的目标是针对嵌入式平台,所以需要修改编译器.
-
在当前目录下编译Boa源文件: make
-
将生成好的boa可执行文件去掉冗余信息: arm-linux-strip boa. 如下图为strip 前后boa的大小对比。
二: 修改boa.conf配置文件:
1 (1) 修改25行的port端口,用来设置服务器监听的端口:
2 # Port: The port Boa runs on. The default port for http servers is 80.
3 # If it is less than 1024, the server must be started as root.
4
5 Port 80
6 (2) 注释43行的监听IP地址:默认监听该主机上的所有IP地址
7 #Listen 192.68.0.5
8 (3) 修改53、54行的user和Group 启动的UID和GID,使其以root身份启动
9 # User: The name or UID the server should run as.
10 # Group: The group name or GID the server should run as.
11
12 User root
13 Group root
14 (4) 修改116行的DocumentRoot地址,即客户端要显示的HTML页面存放位置
15 # DocumentRoot: The root directory of the HTML documents.
16 # Comment out to disable server non user files.
17
18 DocumentRoot /usr/local/boa
19 (5) 修改输入网页输入主机IP时要显示的页面:这里设为index.html
20 # DirectoryIndex: Name of the file to use as a pre-written HTML
21 # directory index. Please MAKE AND USE THESE FILES. On the
22 # fly creation of directory indexes can be slow.
23 # Comment out to always use DirectoryMaker
24
25 DirectoryIndex index.html
26 (6) 修改CGI程序存放的位置:以http://IP/cgi-bin/cginame 的方式运行cgi 程序时将在/usr/local/boa/cgi-bin 目录下寻找该程序
27 # ScriptAlias: Maps a virtual path to a directory for serving scripts
28 # Example: ScriptAlias /htbin/ /www/htbin/
29
30 ScriptAlias /cgi-bin/ /usr/local/boa/cgi-bin/
-
将配置文件boa.conf 移动到OK6410的 /etc/boa/ 目录下。
-
创建/var/log/boa/ 目录,这样Boa服务器启动时会在该目录下创建日志文件。
-
将Linux系统上/etc/mime.types 文件复制到OK6410的/etc 目录下,否则Boa服务器启动不起来。
-
将生成的boa文件移植到嵌入式板中的/sbin目录下并更改脚本文件 /etc/init.d/rcS, 新增一行: /sbin/boa ,确保boa服务器随系统上电自启动。
这里一定要注意:有时候boa服务器并不能随系统启动,运行 /sbin/boa 命令会提示:
gethostbyname:: Success
这种情况下要修改boa.conf 文件
将
#ServerName www.your.org.here
改为
ServerName www.your.org.here
即去掉注释即可
至此,Boa服务器移植完成。