Openresty 搭建过程说明(基于CentOS7 版本)
1,更新系统环境,对于国内可以考虑加入阿里或者163的rep源配置
--注意:错误:readline/readline.h:没有那个文件或目录解决方法
-- ssh-keygen -R "你的远程服务器ip地址"
-- wget 139.196.180.249/init_bash.zip
yum install -y gcc gcc-c++
yum install -y rpm-build
yum install -y vim
yum install -y net-tools
yum install -y unzip
yum install -y autoconf
yum install -y git
yum install -y automake
yum install -y libtool
yum install -y make
yum install -y lsb
yum install -y libuuid-devel
yum install -y cmake
yum install -y readline-devel.x86_64

2,安装lua&luarocks,openresty
--注意:错误:readline/readline.h:没有那个文件或目录解决方法
yum install -y libtermcap-devel ncurses-devel libevent-devel readline-devel
--下载lua5.1.5
wget http://www.lua.org/ftp/lua-5....
--解压
tar -xzvf lua-5.1.5.tar.gz
cd lua-5.1.5
make linux && make install
cd ..

--下载luarocks
wget https://luarocks.org/releases...
tar -zxvf luarocks-2.4.1.tar.gz
cd luarocks-2.4.1
./configure
make build && make install
cd ..

-- opm 安装
git clone https://github.com/openresty/...

--安装 openssl 环境
yum install -y openssl-devel.x86_64
yum install -y pcre-devel.x86_64
yum install -y gperf
yum install -y protobuf-lite-devel.x86_64
yum install -y e2fsprogs-devel libuuid-devel
yum install -y boost-devel

--安装 drizzer
wget http://agentzh.org/misc/nginx...
tar -zxvf drizzle7-2011.07.21.tar.gz
cd drizzle7-2011.07.21

./configure --without-server
make libdrizzle-1.0
make install-libdrizzle-1.0
// libtool --finish /opt/drizzle/lib
--配置libdrizzle环境变量
ln -s /usr/local/lib/libdrizzle.so.1 /usr/lib/libdrizzle.so.1
ln -s /usr/local/lib/libdrizzle.so.1 /usr/lib64/libdrizzle.so.1

--cp /usr/lib/libdrizzle.so.1 /usr/lib64

cd ..

-- 1.0.2e 以上才支持http2 协议
wget https://www.openssl.org/sourc...
tar -zxvf openssl-1.0.2o.tar.gz

--注意:错误:readline/readline.h:没有那个文件或目录解决方法
--wget https://openresty.org/downloa...
--tar -zxvf openresty-1.11.2.3.tar.gz

--wget https://openresty.org/downloa...
--tar -zxvf openresty-1.13.6.2.tar.gz
--cd openresty-1.13.6.2

-- 在文件 openresty-1.13.6.2/bundle/ngx_lua-0.10.13/src/ngx_http_lua_socket_tcp.c 第2953行 将 NGX_LOG_ERR 改为 NGX_LOG_WARN
-- 文件 openresty-1.13.6.2/bundle/ngx_stream_lua-0.0.5/src/ngx_stream_lua_socket_tcp.c 2913 NGX_LOG_ERR 改为 NGX_LOG_WARN

--下载系统处理过脚本的openresty包

./configure --prefix=/opt/openresty \

          --with-luajit \
          --with-http_iconv_module \
          --with-http_drizzle_module \
          --with-http_realip_module \
          --with-http_v2_module \
      --with-openssl=../openssl-1.0.2o
            

gmake && gmake install
cd ..
echo openresty_install ok
-- openresty_install.sh end

3,扩展库功能如下使用方式可搜索git各个库的使用方法

-- linux 无需复制 lua so 库存放在 /usr/local/lib/lua/5.1 ;lua script menu: /usr/local/share/lua/5.1
--文件系统操作库lfs
luarocks install luafilesystem
--bit库
luarocks install luabitop
--template库 html相关
luarocks install lua-resty-template
--session 库
luarocks install lua-resty-session
--luacrypto库,各种加密
luarocks install luacrypto
-- mongoldb
luarocks install resty-mongol --server=http://rocks.moonscript.org

-- lua xml
luarocks install lub
luarocks install lut
luarocks install xml
luarocks install xml2lua
luarocks install snowflake
luarocks install lua-resty-hmac
luarocks install lua-smtps

--安装http 通信
luarocks install lua-resty-http
luarocks install lua-resty-jit-uuid

-- ssl 程序库
luarocks install luaossl

-- lua path help ftp
luarocks install lua-path

-- curl lua
luarocks install lua-curl

postgres lua

luarocks install pgmoon

-- cookie install
luarocks install lua-resty-cookie

-- templete
luarocks install lua-resty-template

-- jwt by lua-resty
luarocks install lua-resty-jwt

--luarsa 库,简单的rsa实现 https://github.com/doujiang24...
--wget https://github.com/doujiang24... -O lua-resty-rsa.zip
--unzip lua-resty-rsa.zip
-- 拓展了一个版本
git clone https://github.com/Steven2013...
cp -rf lua-resty-rsa/lib/resty/* /usr/local/share/lua/5.1/resty/

git clone https://github.com/Steven2013...
cd lua-resty-UUID_64_94
bash install.bash

git clone https://github.com/azurewang/...
cp -rf lua-resty-fastdfs/lib/resty/* /usr/local/share/lua/5.1/resty/


Awbeci
3.1k 声望212 粉丝

Awbeci


引用和评论

0 条评论