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 refers to the work of 51CTO blog aut...
This article is based on Linux centos8 to install...
Table of contents Preface Standard sfc writing me...
MySQL handles GROUP BY and DISTINCT queries simil...
In the Linux system, there is a kind of file call...
Table of contents getting Started Data storage Co...
Table of contents Drag and drop implementation Dr...
This article uses examples to illustrate how to v...
Docker private image library Docker private image...
Step 1: Download the mysql driver cmd enters the ...
Display different menu pages according to the use...
Integrity constraints Integrity constraints are f...
Web page design related questions, see if you can...
Table of contents Introduction Four characteristi...
Table of contents 1. Principle Overview Query Cac...