nginx配置http访问指向到https
Sonder
2020-04-06
351字
1分钟
浏览 (3.6k)
把不带www的域名指向到带www的域名
if ($host = 'baiyongj.com') {
rewrite ^/(.*)$ https://www.baiyongj.com/$1 permanent;
}
配置http指向到https,把每个URL都指向到https
if ($server_port = 80) {
return 301 https://$server_name$request_uri;
}
if ($scheme = http) {
return 301 https://$server_name$request_uri;
}
error_page 497 https://$server_name$request_uri;