Nginx的编译安装

1
    公司:
          我们线上业务已经有Nginx了,现在要新上一个业务,你给我把Nginx安装一下,按照之前的安装方式进行,怎么办?
            1.先使用nginx -V 获取所有的编译参数
            2.按照所有的参数,在新的服务器上进行编译安装

          你给我们的Nginx安装一个第三方模块?
            1.先使用nginx -V 获取所有的编译参数
            2.给nginx的源码导入第三方模块的补丁包(就是三方模块重写的一些c语言程序,替换了官方源码中的一些c语言程序)
            3.按照之前的编译参数, + 第三方模块的参数(使用add-module) ,在新的服务器上进行编译安装 
            4.验证模块是否有效,是否可用。( 三方模块官方站点获取对应的文档 )


0) 安装Nginx所依赖的库文件或开发包
   yum install gcc redhat-rpm-config \
    libxslt-devel gd-devel perl-ExtUtils-Embed \
    geoip-devel gperftools-devel pcre-devel openssl-devel -y

1)下载软件、解压
    [root@nfs ~]# useradd nginx
    [root@nfs ~]# wget http://nginx.org/download/nginx-1.14.2.tar.gz
    [root@nfs ~]# tar xf nginx-1.14.2.tar.gz
    [root@nfs ~]# cd nginx-1.14.2/

2)编译

    ./configure --prefix=/etc/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 --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --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_stub_status_module --with-http_auth_request_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-http_perl_module=dynamic --with-threads --with-stream --with-stream_ssl_module --with-http_slice_module --with-mail --with-mail_ssl_module --with-file-aio --with-http_v2_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic'

    make
    make install 


2.请给Nginx1.14版本添加第三方模块? nginx_upstream_check_module

[root@nfs ~]#wge thttps://github.com/yaoweibin/nginx_upstream_check_module/archive/master.zip
 [root@nfs ~]# unzip master.zip
 [root@nfs ~]# cd nginx-1.14.2/
 [root@nfs nginx-1.14.2]# patch -p1 <../nginx_upstream_check_module-master/check_1.14.0+.patch


    ./configure --prefix=/etc/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 --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --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_stub_status_module --with-http_auth_request_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-http_perl_module=dynamic --with-threads --with-stream --with-stream_ssl_module --with-http_slice_module --with-mail --with-mail_ssl_module --with-file-aio --with-http_v2_module --add-module=/root/nginx_upstream_check_module-master --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic'

    make 
    make install
 

你可能感兴趣的:(LINUX基础)