nginx+lua (一)

项目工程结构

hello

    hello.conf     

    lua              

      hello.lua

    lualib            

      *.lua

      *.so

 

新建hello.conf

server {  

    listen       80;  

    server_name  _;  

 

    location /lua {  

        default_type 'text/html';  

        lua_code_cache off;  

        content_by_lua_file /usr/example/lua/test.lua;  

    }  

}  

新建 test.lua脚本

ngx.say("hello world"); (测试脚本)

增加配置

/usr/servers/nginx/conf/nginx.conf

在http中 include /usr/hello/hello.conf;  

 

 

查看异常日志

tail -f /usr/servers/nginx/logs/error.log

重新nginx加载配置

/usr/servers/nginx/sbin/nginx -s reload  

 

posted @ 2017-10-05 16:53  清渡茶叶  阅读(144)  评论(0编辑  收藏  举报