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

server_name  www.youwebsite.com youwebsite.com;

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

nginx 配置http重定向到https

 

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

会自动跳转到https下

 

相关文章: