嵌入式Web服务器的设计及其CGI实现
- 格式:pdf
- 大小:102.39 KB
- 文档页数:3
摘要论文主要介绍了基于ARM9的嵌入式Web服务器Boa的软、硬件设计及其实现,其中硬件部分的核心是三星的S3C2410X为处理器。
最后成果形式为可以远程访问的WebServer嵌入式服务器。
Boa是一款单任务的HTTP服务器。
与其他传统的Web服务器不同的是当有连接请求到来时,它并不为每个连接单独创建进程, 也不通过复制自身进程来处理多链接。
而是通过建立HTTP请求列表来处理多路HTTP连接请求。
同时它只为CGI程序创建新的进程,这样就在最大程度上节省了系统资源,这对嵌入式系统来说至关重要。
同时它还具有自动生成目录、自动解压文件等功能。
因此, Boa在嵌入式系统中具有很高的应用价值。
关键词:ARM;Linux;嵌入式Web服务器;CGIThis paper has mainly developed the software hardware design and realization of the embedded Web server Boa based on ARM. And the core of the hardware part is S3C2410X microprocessor produced by Samsung . The final achievement is the embedded webserver which can remote visit. Boa is a single-tasking HTTP server. That means that unlike traditional webservers, it does not fork for each incoming connection, nor does it fork many copies of itself to handle multiple connections. It internally multiplexes all of the ongoing HTTP connections. And forks only for CGI programs, this is very important to embedded system. At the same time, it also has the function of automatic directory generation、automatic file gunzipping and so on. So Boa is of highly value in the embedded system application.Keywords: ARM;Linux;Embedded Web server;CGI摘要 (1)Abstract (2)目录 (3)第一章引言 (5)第二章课题背景 (6)2.1 嵌入式系统简介 (6)2.2 嵌入式系统和Linux (6)2.3 ARM9硬件平台 (7)2.3.1 ARM简介 (7)2.3.2 JXARM9-2410 ARM嵌入式教学实验系统 (8)第三章嵌入式Web服务器 (9)3.1 概述 (9)3.2 Web服务器原理 (9)3.3 嵌入式Web服务器实现原理 (9)3.3.1 TCP/IP协议 (9)3.4 嵌入式Web服务器Boa (10)3.4.1 Boa概述 (10)3.4.2 Boa的功能实现 (11)第四章CGI技术 (12)4.1 CGI概述 (12)4.2 CGI工作原理 (12)第五章建立嵌入式系统开发环境 (14)5.1 在Vmware下安装Redhat 9.0 (14)5.2 编译配置主机开发环境 (18)5.2.1 配置以太网 (18)5.2.2 安装配置tftp服务器 (19)5.2.3 配置防火墙 (21)5.2.4 配置NFS服务器 (22)5.3 JXARM9-2410中U-boot烧写 (22)5.3.1 u-boot的功能 (22)5.3.2 使用ADT IDE烧写u-boot (23)第六章系统功能的实现 (25)6.1 GCC简介 (25)6.1.1 GCC概述 (25)6.1.2 GCC基本用法 (25)6.2 Linux内核移植 (26)6.2.1 Linux内核源代码的安装 (26)6.2.2 Linux交叉编译环境的建立和使用 (27)6.2.3 Linux内核的配置和编译 (27)6.3 加载Linux内核映像 (30)6.4 Boa Web服务器的移植 (31)6.4.1 Boa Web服务器的建立 (31)6.5 Linux下动态Web页面的实现 (32)6.5.1 CGI程序分析 (32)6.5.2 Form输入的分析和解码 (34)第七章系统功能的测试 (36)7.1 测试Web服务器 (36)7.2 动态Web页面测试 (37)结束语 (40)致谢 (41)参考文献 (42)附录 (43)第一章引言随着计算机技术的发展,嵌入式系统已成为计算机领域的一格重要组成部分。
基于LwIP的嵌入式设备Web服务器设计与实现陈志星;杨金孝【摘要】随着嵌入式设备的发展,很多嵌入式设备都具有网口通信功能,通过网口对嵌入式设备进行内部参数设置是一种既方便又简单的方式.设计了一种基于LwIP协议的嵌入式设备Web服务器.利用网页就可以配置嵌入式设备内部参数及程序升级.充分利用STM32平台内部集成以太网模块和LwIP轻型网络协议栈的特点,通过以太网物理层芯片LAN8720和RJ45接口相连,完成了网页和Web服务器之间的数据收发.测试表明,设计的基于LwIP协议栈的嵌入式设备Web服务器是正确和可行的.%With the development of embedded devices,many embedded devices have the function of network communication,and it is a convenient and easy way to set the internal parameters of embedded devices through the network port. This paper designs an embedded device Web server based on LwIP protocol. The internal parameters of embedded devices can be configured and updated by using the web page. The Web server make full use of the platform of STM32 internal integration Ethernet modules and the characteristics of LwIP light network protocol stack. Through the Ethernet physical layer chip LAN8720 and RJ45 interface to link together,Web pages and Web server can achieve bidirectional data transmission. The test shows that the embedded device Web server based on the LwIP protocol stack is correct and feasible.【期刊名称】《电子设计工程》【年(卷),期】2018(026)011【总页数】4页(P110-113)【关键词】LwIP;STM32;LAN8720;Web服务器;嵌入式设备【作者】陈志星;杨金孝【作者单位】西北工业大学电子信息学院,陕西西安710129;西北工业大学电子信息学院,陕西西安710129【正文语种】中文【中图分类】TN919.6随着物联网技术的兴起和智能家居的发展,嵌入式设备需要接入局域网或者因特网已成为一种趋势,由于网口通信比其他模式通信速率高且抗干扰性强,在局域网中往往很多嵌入式设备只留有网口供于外部通信,此时对于嵌入式设备内部一些参数设置和内部程序升级只能由网口通信完成。
嵌入式系统的设计和实现嵌入式系统是指集成了计算机芯片、控制器、传感器等硬件设备的特殊电子设备系统。
它通常运行在一些资源受限的嵌入式处理器上,具有实时性、可靠性、成本低廉等特点。
如今,随着信息技术的迅速发展,嵌入式系统已经广泛应用在各种领域,例如智能家居、智能交通、智能医疗等。
嵌入式系统设计开发的核心,在于硬件电路的设计和程序代码的编写。
本文将从嵌入式系统的设计和实现两个方面,探讨如何开发一款成功的嵌入式系统。
一、嵌入式系统的设计1.硬件电路设计嵌入式系统的硬件设计是系统整体性能的基础,是开发过程中必不可少的一步。
在设计硬件电路时,需要首先了解嵌入式系统所需的硬件组件,比如处理器、存储器、输入输出设备、传感器等。
其次,需要根据设计目标和系统要求,选择合适的硬件设备,并将其组合成合理的电路结构。
最后,需要完成电路设计的的绘制及原理图、PCB的布线等工作。
在这个过程中,设计者需要考虑功耗、散热、成本等多个因素。
2.软件设计嵌入式系统的软件设计是嵌入式系统开发的重中之重。
在软件设计方面,需要仔细考虑嵌入式系统的程序架构及程序设计模式,比如事件驱动模型或多任务模型。
同时,需要考虑系统的实时性和稳定性,确保系统代码的质量和可靠性。
在软件设计过程中,需要使用一些工具和开发环境,如Keil、IAR、Eclipse等集成开发环境。
3.测试与调试测试和调试是嵌入式系统开发的重要环节,只有将系统进行充分测试与调试,才能保证系统的正确性和稳定性。
在测试过程中,需要首先进行各个模块的单元测试,以验证系统的功能是否正常。
然后进行集成测试,交叉验证各个模块的协同工作是否正常。
最后进行耐久性测试和压力测试,确保系统能够在各种恶劣环境环境下正常运行。
二、嵌入式系统的实现1. 系统内核系统内核是嵌入式操作系统的核心,也是嵌入式系统的核心。
系统内核需要提供一个可靠的执行环境和一些重要的操作系统服务,如任务管理、内存管理、中断管理、设备驱动程序和通讯协议等。
计算机与现代化2013年第2期JISUANJI YU XIANDAIHUA总第210期文章编号:1006-2475(2013)02-0094-05收稿日期:2012-09-14作者简介:徐叶(1989-),女,山东德州人,上海海事大学航运技术与控制工程交通行业重点实验室硕士研究生,研究方向:船舶与港口设备传动控制,工业控制;袁敏(1956-),男,上海人,高级工程师,学士,研究方向:工业自动化,电气控制系统;李国军(1989-),男,山东临沂人,硕士研究生,研究方向:船舶与港口自动化,工业控制。
嵌入式Web 服务器远程监控系统的设计与实现徐叶,袁敏,李国军(上海海事大学航运技术与控制工程交通行业重点实验室,上海201306)摘要:信息技术的高速发展和嵌入式系统的广泛应用给人们的生活带来了革命性的变化,嵌入式系统接入Internet 成为未来的一个趋势。
因此,本文设计一个嵌入式Web 服务器,服务器端采用HTTP 协议和CGI 技术,增加了数据库功能,在客户端的用户可以通过Internet 利用浏览器进行远程监控并且可以查看历史数据。
利用OPC 技术实现了Web 服务器与PLC 之间的数据通讯。
这种监控系统不仅满足了监控任务的需要,而且有效降低了运行维护成本,提高了运行效率,具有很高的使用价值。
关键词:嵌入式Web 服务器;远程监控系统;超文本传输协议;通用网关接口;PHP ;OPC 中图分类号:TP393.08文献标识码:Adoi :10.3969/j.issn.1006-2475.2013.02.023Design and Implementation of Remote Monitor and ControlSystem Based on Embedded Web ServerXU Ye ,YUAN Min ,LI Guo-jun(Key Laboratory of Marine Technology and Control Engineering ,Ministry of Communications ,P.R.China ,Shanghai Maritime University ,Shanghai 201306,China )Abstract :The rapid development of information technology and the wide application of embedded system have brought revolution-ary changes to people ’s life.The combination of embedded system and Internet has become a trend of the future.Therefore ,an embedded Web server is designed.This server uses hyper text transfer protocol and common gateway interface technology ,increa-ses database function.In the client ,users can monitor local devices and admin historical data through Internet and browser re-motely.The use of OPC technology achieves communication between the Web server and PLC.This monitor system can not only meet the needs of supervisory task ,reduces the operation and maintenance cost ,but also improves the efficiency.The system is of a very high value in use.Key words :embedded Web server ;remote monitor and control system ;hyper text transfer protocol ;common gateway interface ;PHP ;OPC0引言随着网络化时代的到来,各种信息的网络共享越来越受到人们的重视和青睐。
Linux下嵌⼊式Web服务器BOA和CGI编程开发**⽬录**⼀、环境搭建⼆、相关配置(部分)三、调试运⾏四、测试源码参考五、常见错误六、扩展(CCGI,SQLite)# ⼆、相关配置(部分)boa我的配置:/etc/boa$ sudo vi boa.conf# 下⾯⼏个都是关键点,基本就错这⼏个点上# cumentRoot /var/www#将cgi保存的实际位置和⽹站地址做个对应# ScriptAlias /cgi-bin/ /var/www/cgi-bin/#cgi脚本运⾏时能看到的$PATH(可选)# CGIPath /bin:/usr/bin:/usr/local/bin#如果想在任何位置都能运⾏cgi,要添加这个(可选)AddType application/x-httpd-cgi cgi# 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.252002/03/2204:33:09 jnelson Exp $# 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 88# 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 the addresses# are localhost, ppp, and eth0.# b. Use the VirtualHost directive below to point requests to different# files. Should be good for a very large number of addresses (web# hosting clients).# 2. Run one copy of boa per IP address, each has its own configuration# with a "Listen" directive. No big deal up to 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.#Listen 192.68.0.5# User: The name or UID the server should run as.# Group: The group name or GID the server should run as.Group 0# ServerAdmin: The email address where server problems should be sent.# Note: this is not currently used, except as an environment variable# for CGIs.#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.# If unset, defaults to /dev/stderrErrorLog /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 + gethostbynameServerName .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 breaks commonlog# 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 /var/www# 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: 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 KeepAliveMax 1000# 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.# 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.DefaultType text/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#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/fooAlias /doc /usr/doc# ScriptAlias: Maps a virtual path to a directory for serving scripts# Example: ScriptAlias /htbin/ /www/htbin/ScriptAlias /cgi-bin/ /var/www/cgi-bin/View Codecgi我的配置:sudo vi /etc/apache2/sites-enabled/000-defaultServerName 127.0.0.1<VirtualHost *:80>ServerAdmin webmaster@localhostDocumentRoot /var/www<Directory />Options FollowSymLinksAllowOverride None</Directory><Directory /var/www/>Options Indexes FollowSymLinks MultiViews AllowOverride NoneOrder allow,denyallow from all</Directory>ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/<Directory "/usr/lib/cgi-bin">AllowOverride NoneOptions +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,denyAllow from all</Directory>ErrorLog ${APACHE_LOG_DIR}/error.log# Possible values include: debug, info, notice, warn, error, crit, # alert, emerg.LogLevel warnCustomLog ${APACHE_LOG_DIR}/access.log combined Alias /doc/ "/usr/share/doc/"<Directory "/usr/share/doc/">Options Indexes MultiViews FollowSymLinks AllowOverride NoneOrder deny,allowDeny from allAllow from 127.0.0.0/255.0.0.0 ::1/128</Directory></VirtualHost>View Code下⾯提供⼏个测试代码,转⾃其他⼤佬,不过我找不到⽹址了。