Skip to content

Instantly share code, notes, and snippets.

@TechplexEngineer
Created March 6, 2014 03:21
Show Gist options
  • Select an option

  • Save TechplexEngineer/9381679 to your computer and use it in GitHub Desktop.

Select an option

Save TechplexEngineer/9381679 to your computer and use it in GitHub Desktop.
Run CGI Scripts on a Raspberry Pi with light httpd

Setting up your Pi for CGI

lines starting with a $ indicate a command to run

  1. Make sure you have I2C setup on your PI
  2. $ sudo apt-get install lighttpd # install a web server
  3. $ sudo usermod -aG i2c www-data # add the cgi user to the i2c group
  4. $ mkdir -p /var/www/cgi-bin # create the cgi-bin folder
  5. $ sudo lighty-enable-mod cgi # enable CGI in lighttpd web server
  6. copy your executeable to the /var/www/cgi-bin directory
  7. $ hostname -I # get the local IP of your RPI
  8. With a computer on the same lan as the RPI open the url: http://<RPI IP ADDY>/cgi-bin/<executeable name>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment