标签:定位 腾讯云 下载 utf-8 led 几分钟 list bsp rect
一、如何将http升级到https
需要满足下面三个:
1)检查 Nginx 是否支持 SSL /usr/local/nginx/sbin/nginx -V configure arguments中是否有--with-http_ssl_module 如: nginx version: nginx/1.13.4 built by gcc 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) built with OpenSSL 1.0.2k-fips 26 Jan 2017 TLS SNI support enabled configure arguments: --with-http_ssl_module 2) 若不支持,为nginx添加SSL 模块 进入nginx安装目录执行: ./configure --with-http_ssl_module 然后,注意不要make install make 3)备份原 Nginx 执行脚本 mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old 4)将新版本 Nginx 编译脚本放到可执行文件目录下 cd objs/ cp nginx /usr/local/nginx/sbin/ 5)进行平滑升级 make upgrade
2.2.编辑Nginx配置文件
server { listen 443 ssl; server_name 你的域名; ssl_certificate 你的证书.crt; ssl_certificate_key 你的证书.key; ssl_session_cache shared:SSL:1m; ssl_session_timeout 5m; ssl_ciphers HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on; location / { proxy_pass http://127.0.0.1:8080; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } }
二、同时支持http和https两种请求
nginx配置新增server的配置
# http -> https server { listen 80; server_name 你的域名; rewrite ^(.*)$ https://$host$1 permanent; }
【Nginx】将http升级到https并且同时支持http和https两种请求
标签:定位 腾讯云 下载 utf-8 led 几分钟 list bsp rect
原文地址:https://www.cnblogs.com/756623607-zhang/p/11638413.html