Welcome! Log In Create A New Profile

Advanced

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

Jader H. Silva
January 27, 2014 09:02AM
Hello.

You need to set the content-type to this location. e.g.:

add_header Content-Type text/plain;


2014-01-27 Shohreh <nginx-forum@nginx.us>

> Hello
>
> 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:
> http://wiki.nginx.org/HttpLuaModule
>
> So I used the following...
>
> http://yichunzhang.wordpress.com/2010/05/18/a-simple-ngx_lua-example-for-the-future/
> ... 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 http://192.168.0.10:12345/hello.lua, 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
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>



--
att.
Jader H. Silva
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

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

Shohreh January 27, 2014 08:14AM

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

Jader H. Silva January 27, 2014 09:02AM

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

Shohreh January 27, 2014 10:28AM

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

Jader H. Silva January 27, 2014 11:50AM

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

Yichun Zhang (agentzh) January 27, 2014 03:36PM

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

Shohreh January 28, 2014 06:51AM

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

Yichun Zhang (agentzh) January 28, 2014 03:20PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 310
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready