nginx http强制跳转https

通过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上了

posted @ 2017-08-16 17:40  WinJohn的博客  阅读(312)  评论(0编辑  收藏  举报