Advertisement
Guest User

jow

a guest
Sep 16th, 2010
3,275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.64 KB | None | 0 0
  1. root@OpenWrt:~# opkg install uhttpd-mod-lua
  2. Installing uhttpd-mod-lua (18) to root...
  3. Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/uhttpd-mod-lua_18_ar71xx.ipk.
  4. Configuring uhttpd-mod-lua.
  5. root@OpenWrt:~# uci set uhttpd.main.lua_prefix=/lua
  6. root@OpenWrt:~# uci set uhttpd.main.lua_handler=/root/test.lua
  7. root@OpenWrt:~# cat /root/test.lua
  8. function handle_request(env)
  9.     uhttpd.send("HTTP/1.0 200 OK\r\n")
  10.     uhttpd.send("Content-Type: text/plain\r\n\r\n")
  11.     uhttpd.send("Hello world.\n")
  12. end
  13. root@OpenWrt:~# /etc/init.d/uhttpd restart
  14. root@OpenWrt:~# wget -qO- http://127.0.0.1/lua/
  15. Hello world.
  16. root@OpenWrt:~#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement