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

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

QA

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

본문

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

답변을 작성하시기 전에 로그인 해주세요.
전체 125,873 | RSS
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT