如何在RPi上实现Web server
我想在RPi上实现一个web server,集成进我现在基于Arduino的智能家居系统。有人可以试一下,如何实现吗? 编译LNMP套件即可。。 在debian里装个apache、PHP就可以了。
如果会用python的话。可以直接用python写 http://www.instructables.com/id/Raspberry-Pi-Web-Server/这是个英文版的教程 @luyq, 这个教程不错,正是我想要的。 本帖最后由 中奎 于 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.
• 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”
o Suppose the machine name hosting the emulator is PiHost.
2.2 Setup Apache web server
• 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
http://www.instructables.com/id/Raspberry-Pi-Web-Server/
http://www.geek-workshop.com/thread-1461-1-2.html
http://www.raspberrypi.org/phpBB3/viewtopic.php?p=145885#p145885
PI上的webserver 最合适的就是Openresty了,nginx+lua编程,luajit的速度又巨快,内存消耗也小 sudo python -m SimpleHTTPServer 88
:)
页:
[1]