查看Nginx的版本以及安装详情

    1. [root@nginx-node2 sbin]# ./nginx -V
    2. nginx version: nginx/1.15.3 built by gcc 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC) built with OpenSSL 1.0.2k-fips 26 Jan 2017 TLS SNI support enabled configure arguments: --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module

    添加新的模块并编译这里是以steam模块进行测试验证的
    源码文件地址

    1. [root@nginx-node2 nginx-1.15.3]# pwd
    2. /usr/local/src/nginx-1.15.3
    3. [root@nginx-node2 nginx-1.15.3]# ./configure --prefix=/usr/local/nginx --with-http_v2_module --with-http_ssl_module --with-http_sub_module --with-http_stub_status_module --with-http_gzip_static_module --with-pcre --with-stream
    4. [root@nginx-node2 nginx-1.15.3]# make

    千万不要make install 否则要直接覆盖安装了
    关停nginx同时复制新的nginx启动文件
    关闭nginx服务

    1. systemctl stop nginx

    备份原有nginx二进制文件。

    1. cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak

    复制新编译好的nginx二进制文件。从此处nginx源码目录为:/usr/local/nginx-1.13.4。即为编译命令执行目录。

    1. cp ./objs/nginx /usr/local/nginx/sbin/nginx

    启动测试
    启动nginx。

    1. systemctl start nginx

    查看nginx模块信息。

    1. [root@nginx-node1 sbin]# ./nginx -V
    2. nginx version: nginx/1.15.3 built by gcc 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC) built with OpenSSL 1.0.2k-fips 26 Jan 2017 TLS SNI support enabled configure arguments: --prefix=/usr/local/nginx --with-http_v2_module --with-http_ssl_module --with-http_sub_module --with-http_stub_status_module --with-http_gzip_static_module --with-pcre --with-stream