Page 1 of 1

Web Server and GPIO

Posted: Mon Jun 11, 2012 11:41 pm
by jdmnash
I've successfully completed this tutorial: http://www.instructables.com/id/Web-Con ... y-Pi-GPIO/ titled "Web Control of Raspberry Pi GPIO (UPDATED)"

Everything appears to be functioning correctly. I can log into the pi locally at 192.xxx.xxx.27/control.php and toggle the IO.

I don't have much web server experience beyond a yahoo domain that points to an index.html. How do I make that page accessible over the internet? I have a dyndns domain that I use for other purposes (typically in the format of xxxx.dyndns.org:4949) I don't want to loose this functionality. Is there a way to point a specific port to the .../control.php file on my Pi? What security issues should I be concerned about?

TIA for any advice.

Re: Web Server and GPIO

Posted: Tue Jun 12, 2012 12:50 am
by jdmnash
Found a simple solution here: http://www.raspberrypi.org/phpBB3/viewt ... 468#p94468

(forward port 80 to the LAN ip of the RasPi) public address is xxxx.dyndns.org/control.php.

what if I had more than one? How could I differentiate the two? if the IP of RasPi 1 is 192.168.0.1 and is hosting control.php with port 80 forwarded to it, could RasPi 2 at 192.168.0.2 host /control2.php? Then would I be able to access each one separately by going to xxxx.dyndns.org/control.php and xxxx.dyndns.org/control2.php respectively?

Re: Web Server and GPIO

Posted: Tue Jun 12, 2012 7:04 am
by SirLagz
You can forward external port 80 to Raspi 1 port 80 and external port 81 to Raspi 2 port 80

That would be the easiest way to do it.
Otherwise, you could setup a reverse proxy type setup with apache2 so that you could redirect to the correct RPi depending on which page you go to, but I've never done that sort of thing before so I have no idea how to do it...yet. :D

Re: Web Server and GPIO

Posted: Fri Jun 15, 2012 2:44 pm
by gme
SirLagz wrote:You can forward external port 80 to Raspi 1 port 80 and external port 81 to Raspi 2 port 80

That would be the easiest way to do it.
Otherwise, you could setup a reverse proxy type setup with apache2 so that you could redirect to the correct RPi depending on which page you go to, but I've never done that sort of thing before so I have no idea how to do it...yet. :D

I have documented reverse proxy with apache here for the pi - http://www.gavinwill.me.uk/2012/06/rasp ... rse-proxy/