系统相关
首页 > 系统相关> > nginx设置http请求自动跳转https

nginx设置http请求自动跳转https

作者:互联网

在监听80端口的server块中,添加rewrite ^(.*) https://$server_name$1 permanent;,具体如下:

server{
    listen       80; # 支持HTTP
    server_name  xxx.cn;
    rewrite ^(.*) https://$server_name$1 permanent;
}

标签:http,name,rewrite,server,permanent,https,跳转,80
来源: https://blog.csdn.net/weixin_38106322/article/details/117965047