Discussion:
[OpenWrt-Devel] How to get uhttpd logs
Pratik Prajapati
2015-10-29 10:52:37 UTC
Permalink
Hi,

I am trying to access a lua web page (.lp) hosted using uhttpd server in
openwrt installed on embedded board but i am getting following error:

Bad GatewayThe process did not produce any response


I checked on internet and there is no information for this error, i think
may be i can get some info from uhttpd logs.

So how to get uhttpd logs ?
Jo-Philipp Wich
2015-10-29 10:59:13 UTC
Permalink
Hi,

can you execute this .lp file on the shell? uhttpd is a cgi server, it
executes scripts as commands so they need to be world-readable and
executable.

LuaPages appear to be specific to CGILua or the Kepler project, uhttpd
does not support this syntax out of the box.

~ Jow
Pratik Prajapati
2015-10-29 11:07:46 UTC
Permalink
Running .lp on shell gave me following error:

./index.lp: line1: can't open ?lua: no such file
./index.lp: line2: syntax error: unexpected word (expecting ")")

How to support LuaPages in uhttpd ?

Same lua page is working on buildroot using uhttpd.
Post by Jo-Philipp Wich
Hi,
can you execute this .lp file on the shell? uhttpd is a cgi server, it
executes scripts as commands so they need to be world-readable and
executable.
LuaPages appear to be specific to CGILua or the Kepler project, uhttpd
does not support this syntax out of the box.
~ Jow
_______________________________________________
openwrt-devel mailing list
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Jo-Philipp Wich
2015-10-29 11:13:39 UTC
Permalink
Hi,
Post by Pratik Prajapati
./index.lp: line1: can't open ?lua: no such file
./index.lp: line2: syntax error: unexpected word (expecting ")")
As expected, so its not actually a standalone CGI program but a script
similar to a PHP file.
Post by Pratik Prajapati
How to support LuaPages in uhttpd ?
You need to associate an interpreter with the *.lp extension which is
able to process LuaPages. Not sure if such an interpreter exist, consult
the Kepler / CGILua project for documentation on this.
Post by Pratik Prajapati
Same lua page is working on buildroot using uhttpd.
Do you confuse uhttpd with some other httpd here? As far as I know,
uhttpd is an OpenWrt-only project.


~ Jow
Pratik Prajapati
2015-10-29 11:21:40 UTC
Permalink
Post by Jo-Philipp Wich
As expected, so its not actually a standalone CGI program but a script
similar to a PHP file.
I have .lua for backend operation of .lp

You need to associate an interpreter with the *.lp extension which is
Post by Jo-Philipp Wich
able to process LuaPages. Not sure if such an interpreter exist, consult
the Kepler / CGILua project for documentation on this.
Yes i have added *.lp interpreter extension in /etc/config/uhttpd and given
path of cgilua libraries to it
Their mailing list is dead so i can't get information from them.

Do you confuse uhttpd with some other httpd here? As far as I know,
Post by Jo-Philipp Wich
uhttpd is an OpenWrt-only project.
No, I have cross-compiled uhttpd for buildroot.
Post by Jo-Philipp Wich
Hi,
Post by Pratik Prajapati
./index.lp: line1: can't open ?lua: no such file
./index.lp: line2: syntax error: unexpected word (expecting ")")
As expected, so its not actually a standalone CGI program but a script
similar to a PHP file.
Post by Pratik Prajapati
How to support LuaPages in uhttpd ?
You need to associate an interpreter with the *.lp extension which is
able to process LuaPages. Not sure if such an interpreter exist, consult
the Kepler / CGILua project for documentation on this.
Post by Pratik Prajapati
Same lua page is working on buildroot using uhttpd.
Do you confuse uhttpd with some other httpd here? As far as I know,
uhttpd is an OpenWrt-only project.
~ Jow
_______________________________________________
openwrt-devel mailing list
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Pratik Prajapati
2015-10-29 11:40:31 UTC
Permalink
One more thing, cgilua's makefile in buildroot is having luarocks rule to
compile it but on openwrt i have just copied its makefile (
https://github.com/keplerproject/cgilua/blob/master/Makefile) changes (not
used luarocks)

On Thu, Oct 29, 2015 at 4:51 PM, Pratik Prajapati <
Post by Jo-Philipp Wich
As expected, so its not actually a standalone CGI program but a script
Post by Jo-Philipp Wich
similar to a PHP file.
I have .lua for backend operation of .lp
You need to associate an interpreter with the *.lp extension which is
Post by Jo-Philipp Wich
able to process LuaPages. Not sure if such an interpreter exist, consult
the Kepler / CGILua project for documentation on this.
Yes i have added *.lp interpreter extension in /etc/config/uhttpd and
given path of cgilua libraries to it
Their mailing list is dead so i can't get information from them.
Do you confuse uhttpd with some other httpd here? As far as I know,
Post by Jo-Philipp Wich
uhttpd is an OpenWrt-only project.
No, I have cross-compiled uhttpd for buildroot.
Post by Jo-Philipp Wich
Hi,
Post by Pratik Prajapati
./index.lp: line1: can't open ?lua: no such file
./index.lp: line2: syntax error: unexpected word (expecting ")")
As expected, so its not actually a standalone CGI program but a script
similar to a PHP file.
Post by Pratik Prajapati
How to support LuaPages in uhttpd ?
You need to associate an interpreter with the *.lp extension which is
able to process LuaPages. Not sure if such an interpreter exist, consult
the Kepler / CGILua project for documentation on this.
Post by Pratik Prajapati
Same lua page is working on buildroot using uhttpd.
Do you confuse uhttpd with some other httpd here? As far as I know,
uhttpd is an OpenWrt-only project.
~ Jow
_______________________________________________
openwrt-devel mailing list
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Bastian Bittorf
2015-10-29 11:58:04 UTC
Permalink
Post by Pratik Prajapati
So how to get uhttpd logs ?
1)
run the daemon in foreground: look out
for the exact option string with 'ps'.
here i have to run e.g.:

/usr/sbin/uhttpd -f -h /www -r EG-labor-AP -c /etc/httpd.conf -x
/cgi-bin -u /ubus -t 60 -T 30 -k 20 -A 1 -E /cgi-bin-404.sh -n 3 -N 100
-p 80 -i .sh=/bin/ash -I cgi-bin-404.sh -C /etc/uhttpd.crt -K
/etc/uhttpd

now you should see messages.

2)
there is even more, when:
compile with [x] logging enabled (via menuconfig)

bye, bastian

Loading...