• Tengine添加nginx_lua_module模块


    1、初始化系统环境

    net.ipv4.ip_forward = 1
    net.ipv4.conf.default.rp_filter = 1
    net.ipv4.conf.default.accept_source_route = 0
    kernel.sysrq = 0
    kernel.core_uses_pid = 1
    net.ipv4.tcp_syncookies = 1
    kernel.msgmnb = 65536
    kernel.msgmax = 65536
    kernel.shmmax = 68719476736
    kernel.shmall = 4294967296
    net.ipv4.tcp_max_tw_buckets = 6000
    net.ipv4.tcp_sack = 1
    net.ipv4.tcp_window_scaling = 1
    net.ipv4.tcp_rmem = 4096        87380   4194304
    net.ipv4.tcp_wmem = 4096        16384   4194304
    net.core.wmem_default = 8388608
    net.core.rmem_default = 8388608
    net.core.rmem_max = 16777216
    net.core.wmem_max = 16777216
    net.core.netdev_max_backlog = 262144
    net.core.somaxconn = 262144
    net.ipv4.tcp_max_orphans = 3276800
    net.ipv4.tcp_max_syn_backlog = 262144
    net.ipv4.tcp_timestamps = 0
    net.ipv4.tcp_synack_retries = 1
    net.ipv4.tcp_syn_retries = 1
    net.ipv4.tcp_tw_recycle = 0
    net.ipv4.tcp_tw_reuse = 1
    net.ipv4.tcp_mem = 94500000 915000000 927000000
    net.ipv4.tcp_fin_timeout = 10
    net.ipv4.tcp_keepalive_time = 30
    net.ipv4.ip_local_port_range = 10000    65000

    修改/etc/sysctl.conf

    2、ulimit

    修改/etc/security/limits.conf 文件,发现其下面已新增了nofile的值 ,如下:

    * soft nproc 65535
    * hard nproc 65535
    * soft nofile 65535
    * hard nofile 65535

    注:limits.conf文件实际上就是ulimit命令的配置文件。nproc为打开的最大进程数,nofile为打开的最大文件数。该处和上面的/etc/profile是重复设置的。实现上该处增加了以后,/etc/profile就不用再做配置的,而且该处配置更规范些,可以对用户进行限制 。
    即然以上两处都做了设置,还是有上面的提示,神奇了。后来又乱折腾了半天,突然想到之前在centos 6.3版本配置的时候,

    centos 6.X以后新增了一个/etc/security/limits.d/90-nproc.conf 文件,用于控制nproc 。这里面的默认配置是
    *          soft    nproc     1024
    root       soft    nproc     unlimited
    修改为

    * soft nproc 65535
    * hard nproc 65535
    * soft nofile 65535
    * hard nofile 65535

    1、软件包下载地址:
    http://luajit.org/download/LuaJIT-2.0.5.tar.gz

    https://github.com/simplresty/ngx_devel_kit/releases 

    https://github.com/openresty/lua-nginx-module/releases

    http://tengine.taobao.org/download.html

    2、安装依赖包,避免编译出错:

    yum -y install zlib zlib-devel openssl openssl-devel pcre pcre-devel gcc g++ gcc-c++ gd-devel 

    3、安装配置LuaJIT:因为nginx_lua_module需要它来解析Lua

    tar xf LuaJIT-2.0.5.tar.gz 

    cd LuaJIT-2.0.5 

    make install prefix=/usr/local/luajit 

    make install 

     

    4、添加一个用户

    useradd -s /sbin/nginx -M nginx 

    5、编译Nginx,这里使用动态加载模块的方法。自1.9.11开始,nginx支持动态加载模块

    tar -zxf lua-nginx-module-0.10.11.tar.gz 

    unzip ngx_devel_kit-0.3.0.zip

    unzip nginx_tcp_proxy_module-master.zip

    tar -zxf tengine-2.2.3.tar.gz 

    cd tengine-2.2.3

    ./configure
    --prefix=/usr/local/nginx
    --pid-path=/usr/local/nginx/logs/nginx.pid
    --error-log-path=/usr/local/logs/error.log
    --http-log-path=/usr/local/logs/access.log
    --with-http_gzip_static_module
    --http-client-body-temp-path=/var/temp/nginx/client
    --http-proxy-temp-path=/var/temp/nginx/proxy
    --http-fastcgi-temp-path=/var/temp/nginx/fastcgi
    --http-uwsgi-temp-path=/var/temp/nginx/uwsgi
    --http-scgi-temp-path=/var/temp/nginx/scgi
    --with-mail
    --with-mail_ssl_module
    --add-module=../ngx_devel_kit-0.3.0
    --add-module=../lua-nginx-module-0.10.2 --add-module=/home/jyapp/nginx_tcp_proxy_module-master

    make && make install 

    6、增加一个软连接

    ln -sf /usr/local/lib/libluajit-5.1.so /lib64/libluajit-5.1.so.2

    mkdir -p /var/temp/nginx/client

  • 相关阅读:
    os.mkdir()与 shutil.rmtree()对文件夹的 创建与删除
    tf.assign_add
    任意图像尺寸变成目标尺寸(包含相应的boxes的变换)
    文件的读取(txt文件)
    tensorflow中使用变量作用域及tf.variable(),tf,getvariable()与tf.variable_scope()的用法
    python中字典的建立
    图像上划凸多边形(convexHull()函数)
    Cypress 系列之----01 安装和使用
    Excel应用----制作二级下拉菜单【转】
    Selenium系列之--08 操作已打开的浏览器
  • 原文地址:https://www.cnblogs.com/litzhiai/p/12095509.html
Copyright © 2020-2023  润新知