openResty环境部署文档,openresty部署文档


原文地址:

http://note.youdao.com/share/web/file.html?id=60898bbb59c5aade1443402b6fe26dd9&type=note



最新release版下载地址:http://openresty.org/download/ngx_openresty-1.7.10.2.tar.gz(已经升级到了https://openresty.org/download/ngx_openresty-1.9.3.1.tar.gz tar -zxvf 解压


cd /data/ngx_openresty-1.7.10.2/
./configure --prefix=/data/openresty (./configure --prefix=/data/openresty --with-pcre=/data/pcre-8.32

gmake 
wget https://github.com/brimworks/lua-zlib/archive/master.zip
unzip master.zip
cd lua-zlib-master
cmake -DLUA_INCLUDE_DIR=/data/openresty/luajit/include/luajit-2.1/ -DUSE_LUAJIT=ON
make
cp zlib.so /data/openresty/lualib/

如果报pcre的依赖包没有的话下载 解压到/data目录 gmake install
    把原来的nginx配置文件拷贝到新的目录执行下面的命令:          cp /data/nginx/conf/nginx.conf /data/openresty/nginx/conf/
    修改/data/openresty/nginx/conf/nginx.conf文件
    修改:error_log  /data/openresty/nginx/logs/error.log crit;      gzip_types       text/plain application/x-javascript text/css application/xml application/json;
    添加:      lua_shared_dict healthcheck 1m;      lua_max_running_timers 1024;      init_worker_by_lua_file luaFile/initWorker.lua;      include vhosts/api.conf;      include vhosts/static.conf;          把下面这个两个文件拷贝到/data/openresty/nginx/conf/vhosts目录下面               去掉原来的:include vhosts/default.conf;                                upServer的配置(放nginx.conf的最下面即可):         upstream upServer {            #server 172.16.200.82:8080;            #server 172.16.115.75:8080;            server 172.16.10.118:8080;            keepalive 128;            #keepalive_timeout 60s;            #session_sticky cookie=JSESSIONID domain=api2.v.meizu.com fallback=on path=/ mode=insert option=direct;         }         修改这里server配置实际的jetty的内网IP     
         修改api.conf 的 set $mirrorIdcName "ns";      修改 mirrorIdcName 参数,例如南沙机房的就改为它的镜像机房:wx(无锡)     这里的mirrorIdcName 就是这个机房希望对应的镜像机房,在jetty服务不可用时会请求会被转发到对应的镜像机房。
            下载:http://files.luaforge.net/releases/luasocket/luasocket/luasocket-2.0.2/luasocket-2.0.2.tar.gz
        修改config配置:LUAINC=-I/data/openresty/luajit/include/luajit-2.1/         make & make install

    然后就是把附件解压,luaFile文件夹放到/data/openresty/nginx/下面     require.lua、dispatch.lua放到/data/openresty/lualib/下面     然后在/data/openresty/lualib/resty目录下面新建一个tools目录,把tool.lua文件放到这个新建目录下面     运行/data/openresty/nginx/sbin/nginx

相关内容

    暂无相关文章