我应该在嵌入式系统中使用什么服务器端 Web 技术?
我正在开始一个新项目,我正在尝试找出应该使用哪些技术。 事情是这样的,我正在编写一些将在无线路由器上运行的软件,并且我想提供一个网络界面。 因此,我很可能必须进行一些服务器端 Web 开发。 唯一的问题是我将部署此功能的设备只有 16 MB RAM (Ubiquiti Bullet)。 以下是更多信息:
1.) 我将使用 openwrt (linux)。 2.) 显然它必须是轻量级的 3.) 这是一个学校项目,所以我可以使用任何我想要的技术。
显然 PHP 是显而易见的选择,但是还有其他更令人兴奋的东西吗(我并不热衷于 PHP)。
提前致谢!
I'm starting a new project and I'm trying to figure out what technologies I should use. Here's the deal, I'm writing some software that will run on a wireless router and I would like to provide a web interface. So most likely I will have to do some server-side web development. The only issue is that the device I will be deploying this to only has 16 MB of RAM (Ubiquiti Bullet). Here's some more info:
1.) I'll be using openwrt (linux).
2.) Obviously it has to be lightweight
3.) It's a school project, so I can use any technologies I'd like.
Obviously PHP is the obvious choice, but is there anything else a bit more exciting (I'm not crazy about PHP).
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
OpenWRT 的一些更高版本带有完全用 lua (LuCi) 编写的界面。 您检查过它是否适用吗? 它在标准 CGI 上运行,并由已在 OpenWRT 上运行的嵌入式 Web 服务器调用(这意味着您不必添加另一个软件包)。
查看他们的网站 luci.freifunk-halle.net,它显然是一个功能齐全的 Web 框架,包括MVC,让您能够更快上手!
PHP 对于路由器来说相当大,我认为它不能完全提供您正在寻找的速度! Lua 并不是一种很难上手的脚本语言,它与 PHP 没有什么不同,Lua 网站非常好,有大量的 文档!
Some of the later versions of OpenWRT come with an interface written entirely in lua (LuCi). Have you checked this out to see if it applies? It runs over standard CGI and is called by the embedded web server that is already running on the OpenWRT (meaning you don't have to add yet another software package).
Check out their website luci.freifunk-halle.net, it apparently is a full featured web framework including MVC, so you are able to get started faster!
PHP is rather big for a router, and I think it won't quite provide the speed that you are looking for! Lua is not a hard scripting language to pick up and start with, it is not that different from PHP, and the Lua website is very good and has loads of documentation!
用 C 语言编写。
轻量级网络服务器和内置模块,或者快速CGI。 实际的网络内容是用 C 编写的。您将学会欣赏高级语言,并且可能会使用更少的 RAM。
或者,找到一个不错的小型 http 库并将 http 服务器嵌入到您的网络中用户界面。
Write it in C.
A light-weight webserver and either built-in modules, or FastCGI. The actual web stuff written in C. You will learn to appreciate higher-level languages and you'll probably use less RAM.
Or, find a nice small http library and embed the http server into your web UI.
我属于 C 阵营 - 选择您能找到的最小的服务器,它还允许您插入自己的 API 来控制路由器。 使用 javascript 将尽可能多的逻辑卸载到浏览器,以检查发送到后端的命令,并让您的设计在后端保持简单的表单/url 处理。
此链接包含您可以查看的许多服务器的列表。 Once 声称只有 1k 行代码,这真是太小了
http://www.ibm.com/developerworks/web/library/wa -ltwebserv/
I'm in the C camp - go with the smallest server you can find that also allows you to plug in your own API to control the router. Off load as much logic as you can to the browser using javascript to check commands being sent to the back end, and keep yours design to simple form/url handling on the back end.
This link has a list of a number of servers you can look at. Once claims to be only 1k lines of code which is rockin' small
http://www.ibm.com/developerworks/web/library/wa-ltwebserv/
网络服务器不是问题。 任何支持 CGI 的轻量级 httpd 选项都可以完成这项工作。 对于内容生成,我绝对不会用 C 语言来做。使用 LuCI 框架,并设计一个好的界面!
The webserver is not the problem. Whatever lightweight httpd options supporting CGI will do the job. And for the content generation I would definitely NOT do it in C. Use the LuCI framework, and design a good interface !
考虑制作一个 Webmin 插件。 Webmin:
这不是灵丹妙药,但对于它所服务的利基市场来说,它100%满足了它。 唯一的缺点是,该 API 拥有悠久的历史,但并不十分优雅,而且您不会用它赢得任何流行词奖项。
Consider making a Webmin plugin. Webmin:
It's no silver bullet, but for the niche it serves, it satisfies it 100%. The only downside is that the API, having a long legacy, isn't exactly elegant and you won't win any buzzword awards with it.