nginx http -> https 리다이렉트 순환오류

nginx http -> https 리다이렉트 순환오류

QA

nginx http -> https 리다이렉트 순환오류

답변 1

본문

server {
    listen 80;
    listen 443;

    server_name site.com www.site.com;

    ssl on;
    ssl_certificate /etc/nginx/conf.d/ssl-unified.crt;
    ssl_certificate_key /etc/nginx/conf.d/ssl.key;

    root /var/www/site/public_html;
    index index.html index.php;

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
    }

    if ($scheme = http) {
        return 301 https://site.com$request_uri;
    }
}

site.com www.site.com 으로 들어오면 https://site.com 으로 리다이렉트 시킬려고 하는데

https://site.com 으로 리다이렉트는 되는데 거기에서 페이지 못찾고 

계속 리다이렉트 순환 오류가 발생하네요

    if ($scheme = http) {
        return 301 https://site.com$request_uri;
    }

이 구문만 빼면 리다이렉트는 안되지만 페이지는 http https 둘다 잘 뜨고요

왜 순환 오류가 발생 하는 걸까요 ㅠㅡ

이 질문에 댓글 쓰기 :

답변 1

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 99
© SIRSOFT
현재 페이지 제일 처음으로