Redirecting to SSL using nginx

前端 未结 5 1707
傲寒
傲寒 2020-12-08 16:29

I have http:// and https:// on the same host like the following:

server {

    listen   80;
    listen   443 ssl;

    ...
    ...
}

What I

5条回答
  •  臣服心动
    2020-12-08 16:45

    Or better yet, avoiding the hardcoded server name

    server {
      listen 80;
      rewrite (.*) https://$http_host$1 permanent;
    }
    

提交回复
热议问题