Jump to content

Redirect Loop


Recommended Posts

Hello all,

I am rebuilding our ad server and am having some issues with a redirect loop. The site is being hosted via nginx and php-fpm. Here is the nginx config file:

upstream php {
        server unix:/var/run/php5-fpm.sock;
}

server {
    listen 80;
    server_name name.example.com;
    client_max_body_size 16M;
    client_header_buffer_size 16k;
    large_client_header_buffers 16 256k;
    set $root_dir "/var/web/revive-adserver/www";
    root $root_dir;
    charset utf-8;
    access_log /var/log/nginx/name.example.com_access.log sk_combined;
    error_log /var/log/nginx/name.example.com_error.log;

    location / {
        index index.php;
        gzip on;
        gzip_vary on;
        root $root_dir;
        try_files $uri $uri/ /index.php;
    }

    location ~ ^/fpm-(status|ping)$ {
            access_log off;
            allow 127.0.0.1;
            allow 10.0.0.0/8;
            allow 172.16.0.0/16;
            allow 192.168.0.0/16;
            deny all;
            include fastcgi_params;
            fastcgi_pass php;
    }

    location ~ ^/admin$ {
            access_log off;
            allow 127.0.0.1;
            allow 10.0.0.0/8;
            allow 172.16.0.0/16;
            allow 192.168.0.0/16;
            deny all;
            include fastcgi_params;
            fastcgi_pass php;
    }

    location ~ \.php$ {
        fastcgi_index index.php;
        fastcgi_split_path_info ^(.+.php)(/.+)$;
        fastcgi_pass php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
        try_files $uri $uri/ =404;
    }
}

The site worked great in testing (a.k.a without the existing database) but seems to just end up in a redirect loop between admin/index.php and admin/install.php:

192.168.168.232 - - [13/Oct/2015:13:17:51 -0500] "GET /admin/index.php HTTP/1.1" 302 258 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36" 0.005
192.168.168.232 - - [13/Oct/2015:13:17:51 -0500] "GET /admin/install.php HTTP/1.1" 302 224 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36" 0.185
192.168.168.232 - - [13/Oct/2015:13:17:51 -0500] "GET /admin/index.php HTTP/1.1" 302 258 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36" 0.002
192.168.168.232 - - [13/Oct/2015:13:17:51 -0500] "GET /admin/install.php HTTP/1.1" 302 224 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36" 0.144
192.168.168.232 - - [13/Oct/2015:13:17:51 -0500] "GET /admin/index.php HTTP/1.1" 302 258 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36" 0.004
192.168.168.232 - - [13/Oct/2015:13:17:51 -0500] "GET /admin/install.php HTTP/1.1" 302 224 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36" 0.139

I can provide further config files if needed but is there an easy way to stop the redirects?

Link to comment
Share on other sites

  • 3 weeks later...

I would try it without theĀ 

        try_files $uri $uri/ /index.php;
config parameter. Apart from that it's quite a weird redirect loop that you have there. Are you rewriting any hostname or something ? Revive seems to think it's not installed on that domain.
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...