centos7編譯安裝nginx及無縫升級https
阿新 • • 發佈:2018-04-11
itl download err sha2 進行 ast ref 配置文件 CP
[html] view plain copy
安裝依賴:
[html] view plain copy
- yum install -y gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel
[html] view plain copy
- wget -c https://nginx.org/download/nginx-1.10.1.tar.gz
- tar -zxvf nginx-1.10.1.tar.gz
- cd nginx-1.10.1
1、默認配置
[html] view plain copy
- ./configure
[html] view plain copy
- ./configure \
- --prefix=/usr/local/nginx \
- --conf-path=/usr/local/nginx/conf/nginx.conf \
- --pid-path=/usr/local/nginx/conf/nginx.pid \
- --lock-path=/var/lock/nginx.lock \
- --error-log-path=/var/log/nginx/error.log \
- --http-log-path=/var/log/nginx/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
[html] view plain copy
- make
- make install
[html] view plain copy
- vi /etc/rc.local
[html] view plain copy
- /usr/local/nginx/sbin/nginx
[html] view plain copy
- chmod 755 /etc/rc.local
[html] view plain copy
- cd /usr/local/nginx/sbin/
- ./nginx
- ./nginx -s stop
- ./nginx -s quit
- ./nginx -s reload
1、查看nginx是否支持ssl:1、查看nginx是否支持ssl:
[html] view plain copy
- /usr/local/nginx/sbin/nginx -V
[html] view plain copy
- ./configure --with-http_ssl_module
- make
[html] view plain copy
- mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old
3、把新編譯的nginx執行腳本拷貝到相應的目錄下:
[html] view plain copy
- cd objs/
- cp nginx /usr/local/nginx/sbin/
[html] view plain copy
- cd ..
- make upgrade
[html] view plain copy
- cd /usr/local/nginx/conf
- vim nginx.conf
- listen 443;
- server_name 域名;
- index index.html index.htm index.php;
- root 項目根路徑;
- ssl on;
- ssl_certificate 證書路徑及文件;
- ssl_certificate_key 證書路徑及文件;
- ssl_session_timeout 5m;
- ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
- ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
- ssl_prefer_server_ciphers on;
版權聲明:本文為博主原創文章,未經博主允許不得轉載。 https://blog.csdn.net/dreamsqifan/article/details/73467672
centos7編譯安裝nginx及無縫升級https