LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 6634|回复: 38

请教一个关于在嵌入式平台上的boa webserver的问题

[复制链接]
发表于 2005-6-10 08:11:04 | 显示全部楼层 |阅读模式
我在我的嵌入式平台上安装了一个boa服务器,能够跑起来,外界也能访问服务器指定的网页。但是当访问在boa.conf指定的cgi-bin目录下的cgi程序时,系统就死机了。我的cgi程序本身应该没有什么问题,通过串口直接在平台上是能跑起来的,如./mult.cgi在终端上能得到期望的输出。但是通过web页面来访问它的话,就会死机。我想应该是boa程序的问题。不知各位有没有遇到过这样的情况?我想跟一下boa的源码,但又找不到什么好的资料,希望有的提供一下!
发表于 2005-6-10 09:03:29 | 显示全部楼层
可能是你的boa.conf有问题。你把boa.conf帖出来看看。
回复 支持 反对

使用道具 举报

发表于 2005-6-10 09:05:29 | 显示全部楼层
转贴:用BOA作为WEB SERVER编译流程说明

WEB SERVER 编译流程说明:

1. 用BOA作为WEB SERVER

\src\makefile下载见附件。

2. 按照"举例介绍uclinux应用程序的编译方法"的步骤编译。但是在第7小步,要修改inittab.conf

/etc> cat inittab

inet:unknown:/bin/inetd

boa:unknown:/bin/boa -c /home 加入这一行

并且把boa.conf 和mime.types文件修改并拷贝到/home目录

为了让boa简单的跑起来:

boa.conf修改方法,粗体字表示修改了

# Boa v0.94 configuration file

# 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.

# The "ServerRoot" is not in this configuration file. It can be compiled

# 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.

Port 80

# User: The name or UID the server should run as.

# Group: The group name or GID the server should run as.

User 0
# nobody

Group 0
# nogroup

# ServerAdmin: The email address where server problems should be sent.

# Note: this is not currently used.

#ServerAdmin root@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.

#ErrorLog /home/error_log

#/var/log/boa/error_log

#ErrorLog /dev/null

# 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

#AccessLog /dev/null

# RefererLog: The location of the referer 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

# referer logging.

#RefererLog /var/log/boa/referer_log

#RefererLog /dev/null

# AgentLog: The location of the agent 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

# User-Agent logging.

#AgentLog /dev/null

#AgentLog /var/log/boa/agent_log

# VerboseCGILogs: this is just a logical switch.

# 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 -- often

# this is www.foo.bar.

#ServerName www.your.org.here

# DocumentRoot: The root directory of the HTML documents.

#DocumentRoot /var/www

DocumentRoot /home/httpd

# ChRoot: Boa root '/' directory. This is useful to improve security of

# your system. Don't forget that ALL DIRECTORIES used by boa except logs

# must be in this directory. If you need cgi scripts, you must copy shared

# libraries to this directory (see ldconfig(8) for more info)

#Chroot /var

# UserDir: The name of the directory which is appended onto a user's home

# directory if a ~user request is recieved.

UserDir public_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_.

#

DirectoryIndex index.html

DirectoryMaker /usr/local/sbin/boa_indexer

# LocalCodepage: Local codepage. This is send to client in 'Content-Type:'

# header by default.

#LocalCodepage iso-8859-1

# Codepage: Load codepage conversion table from file. This table will be used

# on-the-fly conversion.

#Codepage us-ascii /usr/lib/boa/iso-8859-2/us-ascii

# CodepageByURL: Specify URL prefix codepage. This command is used for manual

# codepage selection. For example, http://www.cz.boa.org/asc/document.html

# converts /document.html to us-ascii

#CodepageByURL /asc us-ascii

# CodepageByBrowser: Specify codepage by $USER_AGENT. This command is used for

# automatic codepage selection. You can use characters '*' and '?' in browser

# string. For example, "CodepageByBrowser Lynx/* us-ascii" will send for Lynx

# users all documents in us-ascii.

#CodepageByBrowser Lynx/* us-ascii

# KeepAliveMax: Number of KeepAlive requests to allow per connection

# Comment out, or set to 0 to disable keepalive processing

KeepAliveMax 100

# KeepAliveTimeout: seconds to wait before keepalive connection times out

KeepAliveTimeout 10

# MimeTypes: This is the file that is used to generate mime type pairs

# and Content-Type fields for boa.

#MimeTypes /etc/mime.types

MimeTypes /home/mime.types

# DefaultType: MIME type used if the file extension is unknown, or there

# is no file extension.

DefaultType text/plain

# 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

#AddType application/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/ /usr/lib/cgi-bin/

# VirtualHost: Maps a virtual host to a directory.

# Example: VirtualHost cz.boa.org /html/htdocs/boa/

#VirtualHost www.second.company.com /var/www/second_company/

# Auth: HTTP Basic authorization. Format is "Auth <Directory> <asswdFile>".

# Password file should be readable _ONLY_ by root or trusted user(s). This file

# is opened before boa gives out privs.

# Example: Auth /secret /var/www/secret.passwd

#Auth /internal /etc/internal.passwd

mime.types文件不改

把主页index.html放在/home/httpd/目录中

3. 完成接下来的几步

4. 启动uclinux, 就可以用IE访问http://192.168.0.3/了。

深入研究需要学习cgi 程序,可以用 web进行控制和显示。

http://www.jmarshall.com/easy/cgi/
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-6-10 09:16:55 | 显示全部楼层
boa.conf文件如下:boa是能跑的,只是在web上调cgi程序就死机。在pc的linux平台上也是没问题的。只是到了嵌入式平台就死机了。
  1. # Boa v0.94 configuration file
  2. # File format has changed little from 0.92
  3. # version changes are noted in the comments
  4. #
  5. # The Boa configuration file is parsed with a lex/yacc or flex/bison
  6. # generated parser.  If it reports an error, the line number will be
  7. # provided; it should be easy to spot.  The syntax of each of these
  8. # rules is very simple, and they can occur in any order.  Where possible
  9. # these directives mimic those of NCSA httpd 1.3; I saw no reason to
  10. # introduce gratuitous differences.

  11. # The "ServerRoot" is not in this configuration file.  It can be compiled
  12. # into the server (see defines.h) or specified on the command line with
  13. # the -c option, for example:
  14. #
  15. # boa -c /usr


  16. # Port: The port Boa runs on.  The default port for http servers is 80.
  17. # If it is less than 1024, the server must be started as root.

  18. Port 80

  19. #  User: The name or UID the server should run as.
  20. # Group: The group name or GID the server should run as.

  21. User root
  22. Group root

  23. # ServerAdmin: The email address where server problems should be sent.
  24. # Note: this is not currently used.

  25. #ServerAdmin root@localhost

  26. # ErrorLog: The location of the error log file. If this does not start
  27. # with /, it is considered relative to the server root.
  28. # Set to /dev/null if you don't want errors logged.

  29. #ErrorLog /var/log/boa/error_log

  30. # AccessLog: The location of the access log file. If this does not
  31. # start with /, it is considered relative to the server root.
  32. # Comment out or set to /dev/null (less effective) to disable
  33. # Access logging.

  34. #AccessLog /var/log/boa/access_log

  35. # RefererLog: The location of the referer log file. If this does not
  36. # start with /, it is considered relative to the server root.
  37. # Comment out or set to /dev/null (less effective) to disable
  38. # referer logging.

  39. #RefererLog /var/log/boa/referer_log

  40. # AgentLog: The location of the agent log file. If this does not
  41. # start with /, it is considered relative to the server root.
  42. # Comment out or set to /dev/null (less effective) to disable
  43. # User-Agent logging.

  44. #AgentLog /var/log/boa/agent_log

  45. # VerboseCGILogs: this is just a logical switch.
  46. # Comment out to disable.

  47. #VerboseCGILogs

  48. # ServerName: the name of this server that should be sent back to
  49. # clients if different than that returned by gethostname -- often
  50. # this is www.foo.bar.

  51. #ServerName www.LG-blackfin.com

  52. # DocumentRoot: The root directory of the HTML documents.

  53. DocumentRoot /home/httpd

  54. # ChRoot: Boa root '/' directory. This is useful to improve security of
  55. # your system. Don't forget that ALL DIRECTORIES used by boa except logs
  56. # must be in this directory. If you need cgi scripts, you must copy shared
  57. # libraries to this directory (see ldconfig(8) for more info)

  58. #Chroot /var

  59. # UserDir: The name of the directory which is appended onto a user's home
  60. # directory if a ~user request is recieved.

  61. UserDir public_html

  62. # DirectoryIndex: Name of the file to use as a pre-written HTML
  63. # directory index.  Please MAKE AND USE THESE FILES.  On the
  64. # fly creation of directory indexes can be _slow_.
  65. #

  66. DirectoryIndex index.html

  67. #DirectoryMaker /usr/boa_indexer

  68. # LocalCodepage: Local codepage. This is send to client in 'Content-Type:'
  69. # header by default.

  70. #LocalCodepage iso-8859-1

  71. # Codepage: Load codepage conversion table from file. This table will be used
  72. # on-the-fly conversion.

  73. #Codepage us-ascii /usr/lib/boa/iso-8859-2/us-ascii

  74. # CodepageByURL: Specify URL prefix codepage. This command is used for manual
  75. # codepage selection. For example, http://www.cz.boa.org/asc/document.html
  76. # converts /document.html to us-ascii

  77. #CodepageByURL        /asc        us-ascii

  78. # CodepageByBrowser: Specify codepage by $USER_AGENT. This command is used for
  79. # automatic codepage selection. You can use characters '*' and '?' in browser
  80. # string. For example, "CodepageByBrowser Lynx/* us-ascii" will send for Lynx
  81. # users all documents in us-ascii.

  82. #CodepageByBrowser Lynx/* us-ascii

  83. # KeepAliveMax: Number of KeepAlive requests to allow per connection
  84. # Comment out, or set to 0 to disable keepalive processing

  85. KeepAliveMax 100

  86. # KeepAliveTimeout: seconds to wait before keepalive connection times out

  87. KeepAliveTimeout 20

  88. # MimeTypes: This is the file that is used to generate mime type pairs
  89. # and Content-Type fields for boa.

  90. #MimeTypes /etc/mime.types

  91. # DefaultType: MIME type used if the file extension is unknown, or there
  92. # is no file extension.

  93. DefaultType text/plain

  94. # AddType: adds types without editing mime.types
  95. # Example: AddType type extension [extension ...]

  96. # Uncomment the next line if you want .cgi files to execute from anywhere
  97. #AddType application/x-httpd-cgi cgi

  98. # Redirect, Alias, and ScriptAlias all have the same semantics -- they
  99. # match the beginning of a request and take appropriate action.  Use
  100. # Redirect for other servers, Alias for the same server, and ScriptAlias
  101. # to enable directories for script execution.

  102. # Redirect allows you to tell clients about documents which used to exist in
  103. # your server's namespace, but do not anymore. This allows you to tell the
  104. # clients where to look for the relocated document.
  105. # Example: Redirect /bar http://elsewhere/feh/bar

  106. # Aliases: Aliases one path to another.
  107. # Example: Alias /path1/bar /path2/foo

  108. #Alias /doc /usr/doc

  109. # ScriptAlias: Maps a virtual path to a directory for serving scripts
  110. # Example: ScriptAlias /htbin/ /www/htbin/

  111. #ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
  112. ScriptAlias /cgi-bin/ /home/httpd/cgi-bin/

  113. # VirtualHost: Maps a virtual host to a directory.
  114. # Example: VirtualHost cz.boa.org /html/htdocs/boa/

  115. #VirtualHost        www.second.company.com /var/www/second_company/


  116. # Auth: HTTP Basic authorization. Format is "Auth <Directory> <PasswdFile>".
  117. # Password file should be readable _ONLY_ by root or trusted user(s). This file
  118. # is opened before boa gives out privs.
  119. # Example: Auth /secret /var/www/secret.passwd

  120. #Auth /etc /etc/passwd
复制代码
回复 支持 反对

使用道具 举报

发表于 2005-6-10 10:00:29 | 显示全部楼层
可能是因为你把UID和GID设为根用户,你把它们设成0试试。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-6-10 10:39:54 | 显示全部楼层
root和0有什么区别?
问题是同样的配置同样的目录结构,只是用不同的编译工具,不同的平台,就出现问题了。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-6-10 11:17:14 | 显示全部楼层
访问cgi程序时出现这样的错误,一般情况下只是死机,这次报了错误再死机。
  1. Data access misaligned address violation
  2. - Attempted misaligned data memory or data cache access.


  3. Exception: IRQ 0x5 entered
  4. code=[0x0000c024],   stack frame=0x179bf28,   bad PC=0x14a675a

  5. ----------- HARDWARE ERROR -----------

  6. External Memory Addressing Error

  7. CURRENT PROCESS:

  8. COMM=boa PID=23
  9. TEXT=01480044-01491c44 DATA=01491c48-014a6a98 BSS=014a6a98-014a6a98
  10. USER-STACK=014bff8c

  11. PC: 014a675a
  12. RETE:  f41cff1e  RETN: bfca8b8c  RETX: 014a675a  RETS: 014bfc38
  13. IPEND: ffffffd1  SYSCFG: 0032
  14. SEQSTAT: 0000c024    SP: 0179bf28
  15. R0: ffffffd1    R1: 017fa480    R2: 00000800    R3: 00000000
  16. R4: 014180c8    R5: 014188ca    R6: ffffffe0    R7: 014189e0
  17. P0: 00000000    P1: 00000003    P2: 01491cd4    P3: 00000116
  18. P4: 01418000    P5: 01418000    FP: 014bfe94
  19. A0.w: 8a88b63e    A0.x: fffffff8    A1.w: 80001a10    A1.x: ffffffee
  20. LB0: 01490b3b  LT0: 01490b22  LC0: 00000000
  21. LB1: 00000001  LT1: b672a264  LC1: 00000000
  22. B0: 881c6c5f  L0: 00000000  M0: 02c06c1e  I0: 0179800b
  23. B1: d62df8be  L1: 00000000  M1: 3d0035ff  I1: 003b5700
  24. B2: 7755eb31  L2: 00000000  M2: 43753993  I2: 000ee0c4
  25. B3: def26b0a  L3: 00000000  M3: 69d45dbf  I3: 9be5fcce

  26. USP: 00000005   ASTAT: 02000002


  27. Kernel panic: Unhandled IRQ or exceptions!
复制代码
回复 支持 反对

使用道具 举报

发表于 2005-6-10 14:03:41 | 显示全部楼层
我也是用的boa,版本是0.94,从来没有出现过这样的问题。我用的是uclinux2.4的内核。
回复 支持 反对

使用道具 举报

发表于 2005-6-10 14:54:10 | 显示全部楼层
> Data access misaligned address violation - Attempted misaligned data memory or data cache access.
这原因看起来好象是访问的内存地址没有对齐造成的。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-6-10 15:08:03 | 显示全部楼层
请问会是什么原因造成Data access misaligned address violation 呢?
回复 支持 反对

使用道具 举报

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

本版积分规则

快速回复 返回顶部 返回列表