[Lua] "Hello, world!" from Lua file?

Shohreh nginx-forum at nginx.us
Mon Jan 27 13:14:03 UTC 2014


Now that I have a working Nginx with the ngx_lua module, I'd like to start
learning how to write web scripts.

The following page doesn't have a basic sample:

So I used the following...
... to edit nginx.conf and write a basic hello.lua file:

================ nginx.conf
    server {
        listen       12345;
        server_name  localhost;

        location / {
            root   html;
            index  index.html index.htm;
            content_by_lua_file hello.lua;
================ html/hello.lua
print("Hello, world!")

But when I call, Chrome downloads the
file instead of displaying the output.

What should I do?

Thank you.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,246864,246864#msg-246864

More information about the nginx mailing list