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

Nginx 配置文件

/etc/nginx/conf.d/*.conf 或 /usr/local/nginx/conf/vhost/*.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;

转自:http://www.cnblogs.com/yudis/articles/6439691.html

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容