Page 1 of 1

HowTo: Rasbpian+ lighttpd + apcupsd-cgi

Posted: Fri Dec 16, 2016 3:59 pm
by ^rooker
Here I'm going to describe the necessary steps to setup apcupsd-cgi using lighttpd (instead of Apache) on Raspberry Pi 1, running Raspbian 8 (Jessie).

1) Install required packages:

Code: Select all

$ sudo apt-get install apcupsd-cgi lighttpd
This will install the apcupsd CGI scripts and the webserver.

2) Configure lighttpd cgi-bin support:

Code: Select all

$ sudo lighttpd-enable-mod cgi
Should return this, if successful:
Enabling cgi: ok
Run /etc/init.d/lighttpd force-reload to enable changes
Reload changes:

Code: Select all

$ sudo service lighttpd restart
3) Link apcupsd CGI scripts:
In order for the apcupsd-cgi scripts we've installed to become accessible, they need to be made available under the "/cgi-bin/" folder in the www-root of the lighttpd webserver.

Create a cgi-bin folder:

Code: Select all

$ sudo mkdir /var/www/html/cgi-bin
Link the apcupsd CGI scripts:

Code: Select all

$ sudo ln -s /usr/lib/cgi-bin/apcupsd/ /var/www/html/cgi-bin/
Now you can access the UPS status by opening the .cgi files in your browser under the following address:
(Change "yourraspbianserver.home" to match your setup)

NOTE: Opening "/cgi-bin/apcupsd" will not work!
Lighttpd does not provide directory listings by default, so you'll get a "404 not found" which is misleading.


Basically, that's it!
Have fun :)



Links: