3649|1

154

帖子

0

TA的资源

一粒金砂(中级)

楼主
 

嵌入式boa web 服务器移植 [复制链接]





四个步骤简单移植BOA服务器


http://www.boa.org/下载Boa源码,将其解压并进入源码目录的src子目录
# tar -zxvf boa-0.94.13.tar.gz


1 设置boa.conf文件设置(红色字体)
  

#Boa v0.94 configuration file
#File format has not changed from 0.93
#File format has changed little from 0.92
#version changes are noted in the comments
#
#The Boa configuration file is parsed with a lex/yacc or flex/bison
#generated parser.  If it reports an error, the line number will be
#provided; it should be easy to spot.  The syntax of each of these
#rules is very simple, and they can occur in any order.  Where possible
#these directives mimic those of NCSA httpd 1.3; I saw no reason to
#introduce gratuitous differences.
#$Id: boa.conf,v 1.25 2002/03/22 04:33:09 jnelson Exp $
#The "ServerRoot" is not in this configuration file.  It can becompiled
#into the server (see defines.h) or specified on the command line with
#the -c option, for example:
#
#boa -c /usr/local/boa
#Port: The port Boa runs on.  The default port for http servers is 80.
#If it is less than 1024, the server must be started as root.
Port80
#Listen: the Internet address to bind(2) to.  If you leave it out,
#it takes the behavior before 0.93.17.2, which is to bind to all
#addresses (INADDR_ANY).  You only get one "Listen" directive,
#if you want service on multiple IP addresses, you have three choices:
#   1. Run boa without a "Listen" directive
#      a. All addresses are treated the same; makes sense if theaddresses
#         are localhost, ppp, and eth0.
#      b. Use the VirtualHost directive below to point requeststo different
#         files.  Should be good for a very largenumber of addresses (web
#         hosting clients).
#   2. Run one copy of boa per IP address, each has its ownconfiguration
#      with a "Listen" directive.  No big deal upto a few tens of addresses.
#      Nice separation between clients.
#The name you provide gets run through inet_aton(3), so you have to use dotted
#quad notation.  This configuration is too important to trust some DNS.
#Listen192.68.0.5
# User: The name or UID the server should run as.
#Group: The group name or GID the server should run as.
User nobody
Group0
#ServerAdmin: The email address where server problems should be sent.
#Note: this is not currently used, except as an environment variable
#for CGIs.
#ServerAdminroot@localhost
#ErrorLog: The location of the error log file. If this does not start
#with /, it is considered relative to the server root.
#Set to /dev/null if you don't want errors logged.
#If unset, defaults to /dev/stderr
#ErrorLog/var/log/boa/error_log
#Please NOTE: Sending the logs to a pipe ('|'), as shown below,
# is somewhat experimental and might fail under heavy load.
#"Usual libc implementations of printf will stall the whole
# process if the receiving end of a pipe stops reading."
#ErrorLog"|/usr/sbin/cronolog --symlink=/var/log/boa/error_log/var/log/boa/error-%Y%m%d.log"
#AccessLog: The location of the access log file. If this does not
#start with /, it is considered relative to the server root.
#Comment out or set to /dev/null (less effective) to disable
#Access logging.
AccessLog/var/log/boa/access_log
#Please NOTE: Sending the logs to a pipe ('|'), as shown below,
# is somewhat experimental and might fail under heavy load.
#"Usual libc implementations of printf will stall the whole
# process if the receiving end of a pipe stops reading."
#AccessLog "|/usr/sbin/cronolog --symlink=/var/log/boa/access_log/var/log/boa/access-%Y%m%d.log"
#UseLocaltime: Logical switch.  Uncomment to use localtime
#instead of UTC time
#UseLocaltime
#VerboseCGILogs: this is just a logical switch.
# It simply notes the start and stop times of cgis in the error log
#Comment out to disable.
#VerboseCGILogs
#ServerName: the name of this server that should be sent back to
#clients if different than that returned by gethostname + gethostbyname
ServerNamewww.your.org.here
#VirtualHost: a logical switch.
#Comment out to disable.
#Given DocumentRoot /var/www, requests on interface 'A' or IP 'IP-A'
#become /var/www/IP-A.
#Example: http://localhost/ becomes/var/www/127.0.0.1
#
#Not used until version 0.93.17.2.  This "feature" also breakscommonlog
#output rules, it prepends the interface number to each access_log line.
#You are expected to fix that problem with a postprocessing script.
#VirtualHost
#DocumentRoot: The root directory of the HTML documents.
#Comment out to disable server non user files.
DocumentRoot/web
#UserDir: The name of the directory which is appended onto a user's home
#directory if a ~user request is recieved.
UserDirpublic_html
#DirectoryIndex: Name of the file to use as a pre-written HTML
#directory index.  Please MAKE AND USE THESE FILES.  On the
#fly creation of directory indexes can be _slow_.
#Comment out to always use DirectoryMaker
DirectoryIndexindex.html
#DirectoryMaker: Name of program used to create a directory listing.
#Comment out to disable directory listings.  If both this and
#DirectoryIndex are commented out, accessing a directory will give
#an error (though accessing files in the directory are still ok).
#DirectoryMaker/usr/lib/boa/boa_indexer
#DirectoryCache: If DirectoryIndex doesn't exist, and DirectoryMaker
#has been commented out, the the on-the-fly indexing of Boa can be used
#to generate indexes of directories. Be warned that the output is
#extremely minimal and can cause delays when slow disks are used.
#Note: The DirectoryCache must be writable by the same user/group that
#Boa runs as.
#DirectoryCache /var/spool/boa/dircache
#KeepAliveMax: Number of KeepAlive requests to allow per connection
#Comment out, or set to 0 to disable keepalive processing
KeepAliveMax1000
#KeepAliveTimeout: seconds to wait before keepalive connection times out
KeepAliveTimeout10
#MimeTypes: This is the file that is used to generate mime type pairs
#and Content-Type fields for boa.
#Set to /dev/null if you do not want to load a mime types file.
#Do *not* comment out (better use AddType!)
MimeTypes/etc/mime.types
#DefaultType: MIME type used if the file extension is unknown, or there
#is no file extension.
DefaultTypetext/plain
#CGIPath: The value of the $PATH environment variable given to CGI progs.
CGIPath/bin:/usr/bin:/usr/local/bin
#SinglePostLimit: The maximum allowable number of bytes in
#a single POST.  Default is normally 1MB.
#AddType: adds types without editing mime.types
#Example: AddType type extension [extension ...]
#Uncomment the next line if you want .cgi files to execute from anywhere
#AddTypeapplication/x-httpd-cgi cgi
#Redirect, Alias, and ScriptAlias all have the same semantics -- they
#match the beginning of a request and take appropriate action.  Use
#Redirect for other servers, Alias for the same server, and ScriptAlias
#to enable directories for script execution.
#Redirect allows you to tell clients about documents which used to exist in
#your server's namespace, but do not anymore. This allows you to tell the
#clients where to look for the relocated document.
#Example: Redirect /bar http://elsewhere/feh/bar
#Aliases: Aliases one path to another.
#Example: Alias /path1/bar /path2/foo
#Alias/doc /usr/doc
#ScriptAlias: Maps a virtual path to a directory for serving scripts
#Example: ScriptAlias /htbin/ /www/htbin/
ScriptAlias/cgi-bin/ /web/cgi-bin/

2. 修改 boa.c  
对于boa-0.94.13版本的
第 225~227 行的程序直接删掉

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


3 makefile 文件的修改
CC = arm-linux-gcc
CPP = arm-linux-gcc

之后就用make命令生成boa可执行文件

4 开发板所需文件

/web/cgi-bin/        /web/index.html
/bin/boa   (boa 是经交叉编译后生成的可执行程序)
/etc/boa/boa.conf     (boa文件没有需要创建,boa.conf是经相关设置后的文件)
/etc/mime.types    (原系统下/etc下有该文件,直接复制过来
记得修改文件读写执行权限

直接就可与运行boa ,然后可以通过网络访问

favicon.ico  没发现,就是随便找个ico文件改名为favicon.ico 然后放在 /web目录下

让boa服务能开机运行在/etc/init.d/rcS 目录下  加上  /bin/boa &

记得加上静态 –static




最新回复

挺好 不错!  详情 回复 发表于 2015-4-18 21:14
点赞 关注

回复
举报

5979

帖子

8

TA的资源

版主

沙发
 
挺好 不错!
 
个人签名生活就是油盐酱醋再加一点糖,快活就是一天到晚乐呵呵的忙
===================================
做一个简单的人,踏实而务实,不沉溺幻想,不庸人自扰
 

回复
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/10 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表