在相应的 server 配置中最后写:
return 301 https://$server_name$request_uri;
使用 301 跳转
转自:https://www.cnblogs.com/xth0331/p/9655576.html