域名:
a.com需求:将
a.com 和
www.a.com ( http 及 https 协议)全部重定向到
https://www.a.com这样写配置可以吗:
server {
listen 80;
listen 443 ssl http2;
server_name
www.a.com a.com;
if ($ssl_protocol = "") { return 301 https://$host$request_uri; }
if ($host !=
www.a.com) { return 301 $scheme://
www.a.com$request_uri; }