nginx中实现把所有http的请求都重定向到https

 在网站启用https之后,我们可能会有一个需求,就是将所有的http的请求自动地重定向到https,

  如果前端是使用的nginx来实现的https,我们可以这样配置nginx的301重定向:

server {  listen	  80;  server_name    xxx.com;  return	  301 https://$server_name$request_uri;
}

server {  listen	  443 ssl;  server_name    xxx.com.com;  [....]
}

原文地址:https://www.cnblogs.com/jiaoyiping/p/5906285.html