Nginx infinite redirect loop

Posted by Zachary Burt on Server Fault See other posts from Server Fault or by Zachary Burt
Published on 2011-08-09T18:43:42Z Indexed on 2012/11/18 17:05 UTC
Read the original article Hit count: 361

Filed under:
|
|

Why is http://compassionpit.com/blog/ going through an infinite redirect loop? Here's my nginx conf file. The site is run by a nodejs server on port 8000 and Apache serves up the blog (wordpress) and the forum (phpBB). The forum is resolving just fine, at http://www.compassionpit.com/forum/ ...

 server {
        listen          80;
        server_name     www.compassionpit.org;
        rewrite         ^/(.*) http://www.compassionpit.com/$1  permanent;
    }


    server {
        listen       80;                # your server's public IP address
        server_name  www.compassionpit.com;
        index        index.php index.html;

        location ~ ^/$ {
            proxy_pass http://127.0.0.1:8000;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header Host $host;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }

        location @blogphp {
            internal;
            root /opt/blog/;
            include fastcgi_params;
            fastcgi_param  SCRIPT_FILENAME  $document_root/index.php;
            fastcgi_index  index.php;
            fastcgi_pass   127.0.0.1:8080;
        }

        location ~ ^/(forum|blog)/($|.*\.php) {
            root /opt/;
            include fastcgi_params;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            fastcgi_index  index.php;
            fastcgi_pass   127.0.0.1:8080;
        }

        location ~ ^/(forum|blog) {
            root /opt/;
            try_files $uri $uri/ @blogphp;
        }

        location ~ ^/(forum|blog)/ {
           root /opt/;
        }


        location @backend {
            internal;
            proxy_pass http://127.0.0.1:8000;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header Host $host;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }

        location ~ / {
            root /opt/chat/static/;
            try_files $uri $uri/ @backend;
        }

    }

© Server Fault or respective owner

Related posts about Wordpress

Related posts about nginx