• nginx


    Nginx 安装

    CentOS 系统

    # 添加 yum 源,CentOS6 - CentOS7
    rpm -Uvh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
    rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
    
    # 在线安装
    yum install nginx
    
    # 启动服务,CentOS6 - CentOS7
    service nginx start
    systemctl restart nginx

    在线安装

    # 在线安装
    apt-get install nginx
    # 启动服务
    service nginx start

    常用命令

    # 显示环境
    nginx -V
    # 检测配置文件是否正确,会告诉你配置文件的位置/etc/nginx/nginx.conf
    nginx -t

    安装 pcre 依赖

    安装 zlib 依赖

    依赖包:安装zlib

    编译源代码安装

    准备源代码: http://nginx.org/en/download.html
    
    https://www.openssl.org/source/
    下载最新版本的openssl-fips包
    tar -xvf openssl-fips-2.0.16.tar.gz
    cd openssl-fips-2.0.16
    ./config
    make
    make install
    编译安装
    tar -xvf nginx-1.14.0.tar.gz
    cd nginx-1.14.0
    # 简单编译
    ./configure --with-pcre=../pcre-8.42 --with-zlib=../zlib-1.2.11 --with-openssl=../openssl-fips-2.0.16
    # 启用stream模块, 支持tcp的转发功能.
    ./configure --with-stream=dynamic --with-pcre=../pcre-8.42 --with-zlib=../zlib-1.2.11 --with-openssl=../openssl-fips-2.0.16
    ./configure --with-stream=dynamic --with-pcre=../pcre-8.43 --with-zlib=../zlib-1.2.11 --with-openssl=../openssl-fips-2.0.16
    make
    make install
    
    # 验证配置文件
    /usr/local/nginx/sbin/nginx -t
    # 修改配置文件
    /usr/local/nginx/conf/nginx.conf
    # 启动程序
    /usr/local/nginx/sbin/nginx
    # 重启程序
    /usr/local/nginx/sbin/nginx -s reload
    
    参考文档:
    http://nginx.org/en/docs/configure.html
    

    查看 nginx 信息

    [root@loanapp tomcat-fssdemo]# nginx -V
    nginx version: nginx/1.12.2
    built by gcc 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC)
    built with OpenSSL 1.0.2k-fips  26 Jan 2017
    TLS SNI support enabled
    configure arguments: --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/run/nginx.pid --lock-path=/run/lock/subsys/nginx --user=nginx --group=nginx --with-file-aio --with-ipv6 --with-http_auth_request_module --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_stub_status_module --with-http_perl_module=dynamic --with-mail=dynamic --with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream=dynamic --with-stream_ssl_module --with-google_perftools_module --with-debug --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' --with-ld-opt='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-E'
    
    
  • 相关阅读:
    每日日报16
    每日日报15
    每日日报14
    每日日报13
    每日日报12
    每日日报11
    每日日报10
    每日作业报告
    每日作业报告
    每日作业报告
  • 原文地址:https://www.cnblogs.com/duchaoqun/p/12964050.html
Copyright © 2020-2023  润新知