nginx 配置http重定向到https

在80端口的那个server下,添加如下:

server_name  www.youwebsite.com youwebsite.com;

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

然后访问 www.网站.com  网站.com

会自动跳转到https下

原文地址:https://www.cnblogs.com/leechenxiang/p/7247995.html