7f2ee50fa559e35d2a8055b68203da963518d5b6
[project/luci.git] / libs / sgi-luci / root / usr / bin / luci-httpd
1 #!/usr/bin/lua
2 require("luci.httpd")
3 require("luci.httpd.server")
4 require("luci.httpd.handler.file")
5 require("luci.httpd.handler.luci")
6
7 DOCROOT = "/www"
8 PORT = 8080
9
10 collectgarbage("setpause", 150)
11
12 serversocket = luci.httpd.Socket("0.0.0.0", PORT)
13
14
15 server  = luci.httpd.server.Server()
16 vhost   = luci.httpd.server.VHost()
17
18 server:set_default_vhost(vhost)
19
20
21 filehandler = luci.httpd.handler.file.Simple(DOCROOT)
22 vhost:set_default_handler(filehandler)
23
24 lucihandler = luci.httpd.handler.luci.Luci()
25 vhost:set_handler("/luci", lucihandler)
26
27 io.stderr:write("Starting LuCI HTTPD on port " .. PORT .. "...\n")
28 io.stderr:write("Point your browser to http://localhost:" .. PORT .. "/luci\n")
29
30 daemon = luci.httpd.Daemon()
31 --daemon.debug = true
32 daemon:register(serversocket, server:create_daemon_handlers())
33 daemon:run()