Nginx+lua+openresty Installation
1, installation dependent
Yum install Libreadline-dev Libncurses5-dev libpcre3-dev Libssl-dev perl
2, download ngx_openresty-xxx.tar.gz and unzip (the Ngx_openresty-xxx/bundle directory contains Nginx core and many third-party modules, such as the LUA and Luajit we need. )
wget https://openresty.org/download/ngx_openresty-1.9.7.2.tar.gz
Tar xvf ngx_openresty-1.9.7.2.tar.gz
CD ngx_openresty-1.9.7.2
3, install Luajit
CD bundle/luajit-2.1-20151219/
Make clean && make && make install
LN-SF Luajit-2.1.0-alpha/usr/local/bin/luajit
4, download the Ngx_cache_purge module, which is used to clean the Nginx cache
wget https://github.com/FRiCKLE/ngx_cache_purge/archive/2.3.tar.gz
Tar xvf 2.3.tar.gz
5, download the Nginx_upstream_check_module module, which is used for upstream health check
wget https://github.com/yaoweibin/nginx_upstream_check_module/archive/v0.3.0.tar.gz
Tar xvf v0.3.0.tar.gz
6, install Ngx_openresty
Cd..
./configure--prefix=/data/webserver/openresty--with-http_realip_module--with-http_stub_status_module-- With-http_gzip_static_module--with-http_gzip_static_module--with-http_ssl_module--with-pcre--with-luajit-- ADD-MODULE=./BUNDLE/NGX_CACHE_PURGE-2.3/--add-module=./bundle/nginx_upstream_check_module-0.3.0/-j2
Make && make install
Parameter description:
--with*** installing some built-in/integrated modules
--with-http_realip_module take user real IP module
-with-pcre Perl-compatible up-to-the-module
--with-luajit Integrated Luajit Module
--add-module Add a custom third-party module, such as this Ngx_che_purge
7, to the/data/webserver/openresty directory with the LL command to view, you will find more than the following directory, indicating the successful installation
[Email Protected]_web openresty]# LL
Total 16
Drwxr-xr-x 2 root root 4096 Apr 09:07 bin
Drwxr-xr-x 6 root root 4096 Apr 09:07 Luajit
Drwxr-xr-x 5 root root 4096 Apr 09:07 lualib
Drwxr-xr-x 6 root root 4096 Apr 09:07 Nginx
Description
/data/webserver/openresty/luajit:luajit environment, Luajit is similar to Java JIT, that is, instant compilation, Lua is an interpretation of the language, through the Luajit can be instantly compiled LUA code to machine code, get good performance;
/data/webserver/openresty/lualib: To use the LUA library, there are some default LUA libraries, such as the Redis,json Library, can also be some of their own development or third-party in this;
/data/webserver/openresty/nginx: Installed Nginx, through/data/webserver/openresty/nginx/sbin/nginx-v view Nginx version and installed module
[Email protected]_web openresty]#/data/webserver/openresty/nginx/sbin/nginx-v
Nginx version:openresty/1.9.7.2
Built by GCC 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC)
Built with OpenSSL 1.0.1e-fips 2013
TLS SNI Support Enabled
Configure arguments:--prefix=/data/webserver/nginxopen/nginx--with-cc-opt=-o2--add-module=. /ngx_devel_kit-0.2.19--add-module=. /echo-nginx-module-0.58--add-module=. /xss-nginx-module-0.05--add-module=. /NGX_COOLKIT-0.2RC3--add-module=. /set-misc-nginx-module-0.29--add-module=. /form-input-nginx-module-0.11--add-module=. /encrypted-session-nginx-module-0.04--add-module=. /srcache-nginx-module-0.30--add-module=. /ngx_lua-0.9.20--add-module=. /ngx_lua_upstream-0.04--add-module=. /headers-more-nginx-module-0.29--add-module=. /array-var-nginx-module-0.04--add-module=. /memc-nginx-module-0.16--add-module=. /redis2-nginx-module-0.12--add-module=. /redis-nginx-module-0.3.7--add-module=. /rds-json-nginx-module-0.14--add-module=. /rds-csv-nginx-module-0.07--with-ld-opt=-wl,-rpath,/data/webserver/nginxopen/luajit/lib--user=www--group=www-- With-http_realip_module--with-http_stub_status_module--with-http_gzip_static_module--with-http_gzip_static_ Module--with-http_ssl_modUle--with-pcre--add-module=/data/ngx_openresty-1.9.7.2/bundle/ngx_cache_purge-2.3--add-module=/data/ngx_ openresty-1.9.7.2/bundle/nginx_upstream_check_module-0.3.0
8, start Nginx
/data/webserver/openresty/nginx/sbin/nginx-s Reload
Nginx+lua+openresty Installation