Nginx重定向到https

时间:2018-03-08 11:47:44

标签: http nginx

这是我需要重定向到https的块:

location / {
            try_files $uri $uri/ index.html?$query_string;
}

有没有办法简单地将其转发给https

1 个答案:

答案 0 :(得分:0)

server {
    server_name                 example.com;
    location / {
        rewrite                 ^(.*)$  https://example.com$1  permanent;
    }
}