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
Problem: The null type data returned by mybatis d...
Preface: MySQL master-slave architecture should b...
Effect If you use it, please optimize the code an...
How to solve the Mysql transaction operation fail...
Docker installs mysql docker search mysql Search ...
This article shares the specific code of vue echa...
Preface After reading the previous article about ...
Lottie is an open source animation library for iO...
In the past few years of my career, I have writte...
Given a div with the following background image: ...
It is troublesome to install the db2 database dir...
Simulation tables and data scripts Copy the follo...
This article shares the specific code of js to ac...
There are three date types in MySQL: date(year-mo...
Tab selection cards are used very frequently on r...