Lubuntu

Creating REST interface with nginx and lua

2 2565
koningh  
Hello!

I'm creating a small monitoring system with my bananapi. I just connected a webcam to the USB port and now I want to be able to start and stop it via a web interface. I have done something similar with a router and OpenWrt: I had a web interface which made sure that a shell script got executed, based on the page that was requested. So for example, when going to 192.168.1.1/api/usb/off, it turned the power of the usb off.

I want to do something similar with the bananapi but currently I'm stuck at getting the combination of nginx and lua to work. I used lua code to execute the shell commands when I was using OpenWrt, so I was hoping that I can reuse some of my lua code on my bananpi. So far I was able to install nginx, but not with HttpLuaModule, which is needed for lua code execution.

Does anyone know a way to make this work? Other ideas are welcome as well! For example, instead of a lua script, a shell script that gets executed when a certain URL is loaded. Or maybe an other webserver package than the nginx, like the uhttpd one used by OpenWrt.

Thanks!
Hi,

if the lua module is not distributed as package ... why don't you trying to compile it manually as explained in the documentation ?

koningh  
I assume you mean the documentation at the HttpLuaModule page? I did both the Openresty as the manual installation but both resulted in a working nginx webserver, but without it begin able to execute a lua file. I'll try it again later this day!

You have to log in before you can reply Login | Sign Up

Points Rules