ngx_lua_module is an nginx http module that embeds the lua parser into nginx to parse and execute web backend scripts written in lua language The features are very good, you can check it out on Baidu. Here is mainly to demonstrate how to install the lua-nginx-module module under Nginx Of course, if you have never installed Nginx before and find the installation troublesome, you can directly download openresty for quick and easy installation, http://openresty.org/cn/installation.html (the work of Zhang Yichun, a big shot of Alibaba, I admire it~~~) 1. Download and install LuaJIT 2.1 (2.0 or 2.1 are both supported, 2.1 is officially recommended): http://luajit.org/download.html cd /usr/local/src wget http://luajit.org/download/LuaJIT-2.1.0-beta2.tar.gz tar zxf LuaJIT-2.1.0-beta2.tar.gz cd LuaJIT-2.1.0-beta2 make PREFIX=/usr/local/luajit make install PREFIX=/usr/local/luajit 2. Download the ngx_devel_kit (NDK) module: https://github.com/simpl/ngx_devel_kit/tags, no installation is required cd /usr/local/src wget https://github.com/simpl/ngx_devel_kit/archive/v0.2.19.tar.gz tar -xzvf v0.2.19.tar.gz 3. Download the latest lua-nginx-module module: https://github.com/openresty/lua-nginx-module/tags, no installation is required cd /usr/local/src wget https://github.com/openresty/lua-nginx-module/archive/v0.10.2.tar.gz tar -xzvf v0.10.2.tar.gz 4.nginx -V to view the compiled configuration nginx -V The author's configuration is as follows: Copy the code as follows: --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-openssl=../openssl-1.0.2h --with-pcre=../pcre-8.38 --with-pcre-jit --with-ld-opt=-ljemalloc --with-ld-opt=-Wl,-rpath,/usr/local/luajit/lib --add-module=/usr/local/src/ngx_devel_kit-0.2.19 --add-module=/usr/local/src/lua-nginx-module-0.10.2 5. Enter the decompressed directory where nginx was installed before, recompile and install (under the configuration obtained by nginx -V, add the directories of ngx_devel_kit-0.2.19 and ua-nginx-module-0.10.2), the final configuration is as follows: Setting Environment Variables export LUAJIT_LIB=/usr/local/luajit/lib export LUAJIT_INC=/usr/local/luajit/include/luajit-2.1 Copy the code as follows: ./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-openssl=../openssl-1.0.2h --with-pcre=../pcre-8.38 --with-pcre-jit --with-ld-opt='-ljemalloc' --with-ld-opt="-Wl,-rpath,/usr/local/luajit/lib" --add-module=/usr/local/src/ngx_devel_kit-0.2.19 --add-module=/usr/local/src/lua-nginx-module-0.10.2 6. Compile and install make -j2 make install 7. Check whether the compilation is successful Add the following code to /usr/local/nginx/conf/nginx.conf: location /hello_lua { default_type 'text/plain'; content_by_lua 'ngx.say("hello, lua")'; } Restart nginx: service nginx restart When you visit 10.211.55.3/hello_lua, "hello, lua" will appear, indicating that the installation is successful. 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:
|
<<: Introduction to Vue3 Composition API
>>: Win2008 R2 mysql 5.5 zip format mysql installation and configuration
This article shares the specific code of Vue.js t...
Sometimes our pages will need some prompt boxes o...
The specific code of JavaScript date effects is f...
Forgetting the password is a headache. What shoul...
1. Use version vite:2.0 ant-design-vue: 2.0.0-rc....
1. What is We can split the communication between...
Table of contents Preface: 1. Introduction to Use...
Today, when I was writing a small program, I used...
Preface I need to add a synchronized scrolling fe...
Many times we want the server to run a script reg...
Table of contents 1. Introduction 2. Principle II...
Preface What is a slow query and how to optimize ...
The previous article on Docker mentioned the cons...
1. Send effect HTML <div id="send-btn&quo...
This article records the specific method of insta...