пятница, 31 октября 2014 г.

301 redirect from http to https + nginx

http://serverfault.com/questions/67316/in-nginx-how-can-i-rewrite-all-http-requests-to-https-while-maintaining-sub-dom

188down voteaccepted

Correct way in new versions of nginx

Turn out my first answer to this question was correct at certain time, but is tunred into another pitfall, to stay up to date please check Taxing rewrite pitfalls
I have been corrected by many SE users, so the credit goes to them, but more important, here is the correct code:
server {
       listen         80;
       server_name    my.domain.com;
       return         301 https://$server_name$request_uri;
}

server {
       listen         443 ssl;
       server_name    my.domain.com;

       [....]
}

Комментариев нет:

Отправить комментарий