Openresty服务器使用lua脚本写的Hello World简单实例
Openresty提供了丰富的接口和变量给Lua,开发者可以充分利用Lua语言特性和这些接口进行高效率开发。万事开头难,但是对于编程来说能写出Hello world就已经算是成功一半了。
1、安装openresty
2、配置nginx
代码如下:
server {
     listen 80;
     server_name localhost;
 
     #charset koi8-r;
 
     #access_log logs/host.access.log main;
 
     location / {
     root html;
          index index.html index.htm;
     }
     location /lua {
          default_type text/plain;
          content_by_lua_file /opt/lua/bin/test.lua;
     }
     ........
}3、新建 /opt/lua/bin/test.lua
代码如下:
local welcome = 'Hello World' ngx.say(welcome)
4、访问即可

相关推荐
  wqiaofujiang    2020-06-16  
   zllbirdonland    2020-06-16  
   CSDNMrWang    2020-05-11  
   陈云佳    2020-04-21  
   Neptune    2020-04-20  
   aolishuai    2020-04-15  
   工作中的点点滴滴    2020-02-15  
   长安长夜Saint    2020-02-14  
   liwf    2020-01-10  
   taoqilin    2020-01-09  
   始终不够    2019-12-06  
   byourb    2019-11-29  
   徐中海C    2019-11-17  
   hong0    2019-11-17  
   SZStudy    2016-07-27  
   oLeiShen    2020-06-25  
   dahege    2020-06-25  
   咻咻ing    2020-06-14  
   liwf    2020-06-10  
 