nginx 80端口跳转443 url保持配置

大部分的金融类网站访问一般并不开启http协议的访问,而是只提供https协议的访问,但有时用户可能在不经意间访问到http下的url这时候就需要,服务器端url的自动跳转功能,对于nginx作为前端服务器的网站而言,一般的配置是这样的,80端口直接跳转到443即可,具体配置代码如下:

  server {
         listen  80;
         server_name xxx.com *.xxx.com;

         rewrite ^(.*)$  https://$http_host$1 permanent;
  }

 xxx.com 代表网站的域名

猜你喜欢

转载自yangchunhe.iteye.com/blog/2359938