Install lua wget http://luajit.org/download/LuaJIT-2.0.5.tar.gz tar -zxvf LuaJIT-2.0.5.tar.gz cd LuaJIT-2.0.5 make && make install PREFIX=/usr/local/LuaJIT etc/profile added # lua export LUAJIT_LIB=/usr/local/LuaJIT/lib export LUAJIT_INC=/usr/local/LuaJIT/include/luajit-2.0 source etc/profile Download the ngx_devel_kit module wget https://github.com/simpl/ngx_devel_kit/archive/v0.3.0.tar.gz NDK (nginx development kit) module is a module that expands the core functions of nginx server. Third-party module development can be quickly implemented based on it. NDK provides functions and macros to handle some basic tasks, reducing the amount of code required for third-party module development. Download lua-nginx-module wget https://github.com/openresty/lua-nginx-module/archive/v0.10.9rc7.tar.gz lua-nginx-module module enables running lua directly in nginx View original compilation nginx -V like: Enter the nginx original directory: ./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-http_sub_module --with-http_v2_module --add-module=/root/lua-nginx-module-0.10.9rc7/ --add-module=/root/ngx_devel_kit-0.3.0 Just run make, do not execute make install. The compilation error should be that the Lua environment variable is incorrect. nginx -V command error./nginx: error while loading shared libraries: libluajit-5.1.so.2: cannot open shared object file: No such file or directory solve: echo "/usr/local/LuaJIT/lib" >> /etc/ld.so.conf ldconfig After success, you can check it with nginx -V and make sure there is no error. Back up the original nginx as nginx_old cp objs/nginx to the original nginx and overwrite it. Execute in the build directory make upgrade Nginx add lua module test: server{ ... location /lua { default_type 'text/html'; content_by_lua ' ngx.say("hello, lua!") '; } ... } The browser opens: http://blog.13sai.com/lua You can see hello, lua! The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Detailed explanation of how to use amoeba to implement read-write separation of MySQL database
>>: Detailed explanation of props and context parameters of SetUp function in Vue3
Table of contents Overview Defining filters Use o...
Table of contents 1. Source code 1.1 Monorepo 1.2...
The CSS position attribute specifies the element&...
On many websites, we have seen the input box disp...
Copy code The code is as follows: <object id=&...
When using setinterval, it is found that it will ...
1. Download https://dev.mysql.com/downloads/mysql...
Configure Tomcat First install Tomcat Installing ...
Caused by: java.sql.SQLException: Incorrect strin...
Introduction: This article mainly introduces how ...
A website uses a lot of HTML5 and CSS3, hoping th...
1. One-stop solution 1. Problem analysis and loca...
When installing the centos7 version, choose to co...
This article uses examples to illustrate the prin...
This article shares the specific code of swiper+e...