首页 > Web开发 > 详细

nginx http301强制跳转https、域名跳转到带www

时间:2018-11-26 19:29:05      阅读:215      评论:0      收藏:0      [点我收藏+]
http强制跳转到https
在nginx配置文件添加:
if ($scheme = http) {
return 301 https://$server_name$request_uri;
}

Nginx跳转自动到带www域名规则配置:
在nginx大server中添加
server{
listen 80;
listen 443;
server_name www.xx.com xx.com;
if ($host != ‘www.xx.com‘) {
rewrite ^/(.*)$https://www.xx.com/$1 permanent;
}

参考文档:http://wenku.it168.com/d_000938140.shtml

nginx http301强制跳转https、域名跳转到带www

原文:http://blog.51cto.com/lmy666/2322235

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!