이전 목록 다음

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

2015-10-02 (금) 10:05:05 6,636
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개

if 문에서 = 이 하나인가요??

답변을 작성하려면 로그인이 필요합니다.