사용자 삽입 이미지

1. HTTPS + non-www

 

server {

    listen 80;

    server_name wsgvet.com www.wsgvet.com;

    location / {

        rewrite       ^/(.*)$ https://wsgvet.com/$1 permanent;

    }

}

 

server {

listen 443 ssl http2;

server_name wsgvet.com www.wsgvet.com;

...

if ($host != 'wsgvet.com' ) {

        rewrite          ^/(.*)$  https://wsgvet.com/$1 permanent;

    }

...

}

 

2. HTTPS + www

 

server {

    listen 80;

    server_name www.wsgvet.com wsgvet.com;

    location / {

        rewrite       ^/(.*)$ https://www.wsgvet.com/$1 permanent;

    }

}    

 

server {

listen 443 ssl http2;

server_name www.wsgvet.com wsgvet.com;

...

if ($host != 'www.wsgvet.com' ) {

        rewrite          ^/(.*)$  https://www.wsgvet.com/$1 permanent;

    }

...

}

 

 

3. 결론

 

성능에는 별 차이없는 것 같습니다만, 예전에는 두번 거쳐서 넘어가는 느낌이라면 

 

지금은 단 한번의 리라이트로 넘어가기 때문에 더 나은 것 같습니다.

2017/03/18 13:23 2017/03/18 13:23

Trackback Address :: https://youngsam.net/trackback/1857