• centos 7 源码安装openresty


    Openresty 官网

    http://openresty.org

    Openresty源码下载页面

    http://openresty.org/en/download.html

    Openresty 简易安装说明页面

    http://openresty.org/en/installation.html

    安装步骤如下

    yum install gcc gcc-c++ make automake autoconf libtool wget unzip git -y
    if [ ! -d "/usr/local/software" ]; then mkdir /usr/local/software;fi
    cd /usr/local/software
    if [ ! -f "/usr/local/software/openresty-1.15.8.2.tar.gz" ];then wget https://openresty.org/download/openresty-1.15.8.2.tar.gz;fi
    if [ ! -f "/usr/local/software/nginx-upstream-dynamic-servers-master.zip" ];then wget http://download.zhufunin.com/nginx-upstream-dynamic-servers-master.zip;fi
    if [ ! -f "/usr/local/software/libmaxminddb-1.3.2.tar.gz" ]; then wget http://download.zhufunin.com/libmaxminddb-1.3.2.tar.gz;fi
    if [ ! -f "/usr/local/software/maxmind-city.mmdb.tar.gz" ]; then wget http://download.zhufunin.com/maxmind-city.mmdb.tar.gz;fi
    if [ ! -f "/usr/local/software/openssl-1.1.0e.tar.gz" ];then wget http://download.zhufunin.com/openssl-1.1.0e.tar.gz;fi
    if [ ! -f "/usr/local/software/pcre-8.42.tar.gz" ];then wget http://download.zhufunin.com/pcre-8.42.tar.gz;fi
    if [ ! -f "/usr/local/software/zlib-1.2.11.tar.gz" ];then wget http://download.zhufunin.com/zlib-1.2.11.tar.gz;fi
    if [ ! -f "/usr/local/software/ngx_http_geoip2_module.zip" ];then wget http://download.zhufunin.com/ngx_http_geoip2_module.zip;fi
    if [ ! -f "/usr/local/software/ngx_brotli.tar.gz" ];then wget http://download.zhufunin.com/ngx_brotli.tar.gz;fi
    
    tar zxf openresty-1.15.8.2.tar.gz
    unzip -o nginx-upstream-dynamic-servers-master.zip
    tar zxf libmaxminddb-1.3.2.tar.gz
    tar zxf maxmind-city.mmdb.tar.gz
    tar zxf openssl-1.1.0e.tar.gz
    tar zxf pcre-8.42.tar.gz
    tar zxf zlib-1.2.11.tar.gz
    unzip -o ngx_http_geoip2_module.zip
    
    cd ./libmaxminddb-1.3.2
    ./configure
    make && make install
    [[ -z `cat /etc/ld.so.conf |grep "/usr/local/lib"` ]] && echo "/usr/local/lib" >> /etc/ld.so.conf
    ldconfig
    
    #brotli git clone source code
    cd /usr/local/software/
    tar zxf ngx_brotli.tar.gz
    #git clone https://github.com/google/ngx_brotli.git
    #cd ./ngx_brotli
    #git submodule update --init
    
    
    groupadd www
    useradd -g www -s /sbin/nologin www
    
    cd ./openresty-1.15.8.2
    ./configure 
    --user=www 
    --group=www 
    --prefix=/usr/local/openresty 
    --with-http_ssl_module 
    --with-http_sub_module 
    --with-http_gzip_static_module 
    --with-http_gunzip_module 
    --with-http_stub_status_module 
    --with-http_realip_module 
    --with-pcre-jit 
    --with-stream 
    --with-http_v2_module 
    --with-http_iconv_module 
    --with-threads 
    --with-http_slice_module 
    --with-openssl=/usr/local/software/openssl-1.1.0e 
    --with-zlib=/usr/local/software/zlib-1.2.11 
    --with-pcre=/usr/local/software/pcre-8.42 
    --with-ld-opt="-Wl,-rpath,/usr/local/lib" 
    --with-luajit 
    --add-module=/usr/local/software/ngx_http_geoip2_module-master 
    --add-module=/usr/local/software/nginx-upstream-dynamic-servers-master 
    --add-module=/usr/local/software/ngx_brotli
    make -j2
    make install
    echo "export PATH=$PATH:/usr/local/nginx/sbin/" >> /etc/profile
    source /etc/profile
    mkdir -p /usr/local/openresty/nginx/ssl
    
    openssl req -x509 -nodes -days 10000 -newkey rsa:2048 -keyout /usr/local/openresty/nginx/ssl/nginx.key -out /usr/local/openresty/nginx/ssl/nginx.crt -subj "/C=US/ST=US/L=US/O=ssl/OU=ssl/CN=ssl.com/emailAddress=admin@ssl.com"
    echo "ulimit -n 65535" >> /etc/profile
    echo "root soft nofile 65535" >> /etc/security/limits.conf
    echo "root hard nofile 65535" >> /etc/security/limits.conf
    echo "* soft nofile 65535" >> /etc/security/limits.conf
    echo "* hard nofile 65535" >> /etc/security/limits.conf
    source /etc/profile

     

    j2代表双核处理,如果CPU是4核,可以写出j4

    请在这个网站生成配置文件https://www.digitalocean.com/community/tools/nginx

    本人的自用配置反向代理,https://www.cnblogs.com/faberbeta/p/nginx-install004.html

  • 相关阅读:
    java 手写 jvm高性能缓存
    给大家推荐一款非常好用的表单验证插件:lr-verify.js
    如何设计处优秀的Restful API
    volatile、static
    微服务学习(一):微服务介绍
    spark过滤算子+StringIndexer算子出发的一个逻辑bug
    spark和深度学习集成调研
    收藏一个不错的个人博客
    二分法中的逼近法
    netty服务端启动--ServerBootstrap源码解析
  • 原文地址:https://www.cnblogs.com/faberbeta/p/nginx003.html
Copyright © 2020-2023  润新知