Nginx uses the lua script, nginxlua script
This article describes how to use the lua script in nginx. The third-party module lua-nginx-module is used to call the lua script in nginx. A Configuration example is provided.
Lua is a language similar to JavaScript. Ngix_Lua also uses asynchronous single-thread, and its syntax is even simpler than JS. According to previous evaluations, the performance of Ngix_lua is almost Node. JS.
Nginx features
1. Popular High-Performance HTTP servers
2. event-driven (asynchronous) Architecture
3. A small amount of memory can be measured
4. Declarative configuration language
5. C-based scalable modules
You can use lua-nginx-module to start the lua script on nginx.
Example:
location / { content_by_lua ' local res = ngx.location.capture("/sub") if res.status >= 500 then ngx.exit(res.status) end ngx.status = res.status ngx.say(res.body) ';}location /sub { echo "Hello, Sub-Request!";}
Lua-nginx-module on Github Project address https://github.com/openresty/lua-nginx-module
Openresty and nginxconf call the lua script. Why is nil always reported when the lua script loads dynamic libraries?
After you install LUA, add the library path to the system variable path.
Generally \ Lua \ 5.1 \ clibs
Download
Lua Rocks provides a simple solution to upgrade and update the Lua extension Library (similar to the yum function in linux)
Nginx calls the lua script, while the lua script calls the functions in the business C program. paste a sample that can be run ~~
I don't know what nginx is.
However, I can help you write a lua call to the c function.