centos7编译安装nginx及无缝升级https
安装依赖:
- yum install -y gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel
- 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、默认配置
- ./configure
- ./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
- make
- make install
- vi /etc/rc.local
- /usr/local/nginx/sbin/nginx
- chmod 755 /etc/rc.local
- cd /usr/local/nginx/sbin/
- ./nginx
- ./nginx -s stop
- ./nginx -s quit
- ./nginx -s reload
1、查看nginx是否支持ssl:1、查看nginx是否支持ssl:
- /usr/local/nginx/sbin/nginx -V
- ./configure --with-http_ssl_module
- make
- mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old
3、把新编译的nginx执行脚本拷贝到相应的目录下:
- cd objs/
- cp nginx /usr/local/nginx/sbin/
- cd ..
- make upgrade
- 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