通过nginx的rewrite 进行301永久重定向,参考如下配置即可。
server {
listen 192.168.1.111:80;
server_name test.com;
rewrite ^(.*)$ https://$host$1 permanent;
}
搭建此虚拟主机完成后,就可以将http://test.com的请求全部重写到https://test.com上了
nginx http强制跳转https
原文:http://www.cnblogs.com/wqcheng/p/7374593.html