==================================================================
1. See if Zlib is present in CentOS?
Rpm-qa | grep zlib
Show:
Zlib-devel-1.2.3-29.el6.x86_64
Zlib-1.2.3-29.el6.x86_64
Indicates that it is installed without worrying too much.
====================================================================
2. Installing the CMake Compiler
Yum install-y gcc gcc-c++ make Automake
wget http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz
TAR-ZXVF cmake-2.8.10.2.tar.gz
CD cmake-2.8.10.2
./bootstrap
Gmake
Gmake Install
Check CMake Installation
CMake--version
Show
CMake version 2.8.10.2
Indicates successful installation
====================================================================
3, download Lua-zlib package, and unzip
Unzip Lua-zlib-master.zip
Cd/usr/local/software/lua-zlib-master
cmake-dlua_include_dir=/usr/local/openresty/luajit/include/luajit-2.1
Make
CP zlib.so/usr/local/openresty/lualib/zlib.so
====================================================================
4. Call in Lua script
local zlib = require " zlib " local Encoding = Ngx.req.get_headers () [ " content-encoding " if encoding = = " gzip " then local body = Ngx.req.get_body_data () if body then local stream = Zlib.inflate () Ngx.req.set_body_data (Stream (body)) EndEnd
====================================================================
Summary of issues:
Makefile is a Linux file, for a project with many files, if compiled directly, then we need to use some commands to include all the files. If we make some changes to some of these files, then we need to re-enter these commands. The makefile file is a good solution to this problem, it contains the required commands in this makefile file, and then simply make a step to complete all the steps.
Methods of using Lua-zlib in Openresty