现在什么苹果,谷歌浏览器请求地扯基本都要求使用https了,如何把原来的http协议重定向到https中呢,这里我们可以使用http反向代理软件nginx。
配置:
/etc/nginx下 nginx的配置文件
server {
listen 80;
server_name niwoxuexi.com www.niwoxuexi.com;
return 301 https://www.niwoxuexi.com$request_uri;
}
server {
listen 443;
server_name niwoxuexi.com niwoxuexi.com;
return 301 https://www.niwoxuexi.com$request_uri;
}
server {
listen 443;
server_name www.niwoxuexi.com;
ssl on;
root html;
index index.html index.htm;
ssl_certificate cert/214114236610728.pem;
ssl_certificate_key cert/214114236610728.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
location / {
root html;
index index.html index.htm;
}
}
以上配置可将www.niwoxuexi.com、niwoxuexi.com与https://niwoxuexi.com 重定向至https://www.niwoxuexi.com地扯中。