OpenWrt UBUS as a CGI program to be used with Lighttpd, BusyBox httpd and Apache HTTPD.
The UBUS over http bridge is implemented as a plugin for uhttpd. There is also nginx-ubus-module. For other web servers you may use this CGI adapter.
Upload to router:
scp -O ubus.sh [email protected]:/www/cgi-bin/ubus.sh
Now enable the script as a UBUS path for Luci:
chmod +x /www/cgi-bin/ubus.sh
uci set luci.main.ubuspath='/cgi-bin/ubus.sh'
uci commit
reboot
Yes, the reboot is required to evict cache.
The BB httpd needs to be compiled with CGI support. See BUSYBOX_CONFIG_FEATURE_HTTPD_CGI
You must install mod_cgi:
opkg lighttpd-mod-cgi
TBD
Then create a configuration /etc/lighttpd/conf.d/99-ubus.conf
:
cgi.assign := (".sh" => "/bin/sh")
To run LuCI on Caddy, prepare a Caddyfile
{
order file_server last
}
:80 {
cgi /cgi-bin/luci* /www/cgi-bin/luci { script_name /cgi-bin/luci }
cgi /ubus* ubus.sh { script_name /ubus }
file_server /luci-static* { root /www }
redir / /cgi-bin/luci
}
See https://sigeryang.net/2022/02/12/caddy-openwrt-luci/
TBD
<Directory "/var/www/htdocs/">
AllowOverride None
Options +ExecCGI
Order allow,deny
Allow from all
</Directory>
Jo-Philipp Wich
See a discussion https://forum.openwrt.org/t/lighttpd-and-ubus-over-json-rpc/117582
0BDSD (similar to Public Domain)