极客工坊

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 13237|回复: 7

如何在RPi上实现Web server

[复制链接]
发表于 2012-7-24 12:21:03 | 显示全部楼层 |阅读模式
我想在RPi上实现一个web server,集成进我现在基于Arduino的智能家居系统。

有人可以试一下,如何实现吗?
回复

使用道具 举报

发表于 2012-7-24 22:49:15 | 显示全部楼层
编译LNMP套件即可。。
回复 支持 反对

使用道具 举报

发表于 2012-7-25 08:57:14 | 显示全部楼层
在debian里装个apache、PHP就可以了。
如果会用python的话。可以直接用python写
回复 支持 反对

使用道具 举报

发表于 2012-7-25 12:00:36 | 显示全部楼层
回复 支持 反对

使用道具 举报

 楼主| 发表于 2012-7-25 20:26:21 | 显示全部楼层
@luyq, 这个教程不错,正是我想要的。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2012-8-12 11:16:55 | 显示全部楼层
本帖最后由 中奎 于 2012-8-12 11:19 编辑

终于在Pi模拟器上实现了web server。详细的实现步骤和思路如下。

1        Abstract
The apache service can run on the Raspberry Pi emulator as a web server. When start the emulator, specify the TCP redirection from the host to emulator. Then the TCP port of the emulator can be accessed outside.


2        Steps to setup web server on emulator
2.1        Prepare the emulator
•        Download the emulator.  [2]
•        Start the emulator with the command line “bin\qemu-system-arm.exe -M versatilepb -cpu arm1136-r2 -hda 2012-06-18-wheezy-beta.img -kernel zImage_3.1.9 -m 192 -append "root=/dev/sda2" -redir tcp:8080::80” [3]
o        Suppose the machine name hosting the emulator is PiHost.

2.2        Setup Apache web server [1]

•        Start the teminaterX.
•        Execute "sudo apt-get update".
•        Execute "sudo apt-get install apache2 php5 libapache2-mod-php5".
o        It will say "Do you want to continue", just press "y" and hit Return / Enter.
•        Execute "sudo groupadd www-data".
•        Execute "sudo usermod -g www-data www-data" to change the user mode.
•        Execute "sudo service apache2 restart" to restart the apache server.
•        Access the web server in NetSurf with the URL: http://localhost/.
•        Verify the web server works.



2.3        Configure the firewall
•        Configure the firewall of the machine PiHost. Enable the inbound of TCP 8080.

2.4        Access the web server

•        Access the web server with the URL: http://PiHost:8080/.
•        Verify the web server is accessible.




3        Reference

[1] http://www.instructables.com/id/Raspberry-Pi-Web-Server/
[2] http://www.geek-workshop.com/thread-1461-1-2.html
[3] http://www.raspberrypi.org/phpBB3/viewtopic.php?p=145885#p145885
回复 支持 反对

使用道具 举报

发表于 2013-1-29 17:48:18 | 显示全部楼层
PI上的webserver 最合适的就是Openresty了,nginx+lua编程,luajit的速度又巨快,内存消耗也小
回复 支持 反对

使用道具 举报

发表于 2013-1-29 18:29:14 | 显示全部楼层
sudo python -m SimpleHTTPServer 88  

回复 支持 反对

使用道具 举报

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

本版积分规则 需要先绑定手机号

Archiver|联系我们|极客工坊

GMT+8, 2024-5-3 15:35 , Processed in 0.047848 second(s), 22 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2021, Tencent Cloud.

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