CentOS7下Nginx强制http 301跳转到https的设置方法


Nginx配置文件:

/etc/nginx/conf.d/*.conf

常见的301跳转设置方法:

一、

if ($scheme = http ) {
    return 301 https://$host$request_uri;
}

二、

server_name 8jieke.com ;
rewrite ^(.*) https://8jieke.com$1 permanent

三、

if ($server_port = 80 ) {
    return 301 https://$host$request_uri;
}

四、

server_name 8jieke.com ;
return 301 https://$server_name$request_uri;

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM