Error: Rewrite or internal redirection cycle after some time

My nginx configuration works fine, but suddenly after some time (mostly
days) he begins to answer 3x and the error occurs in the log below for
all
requests:

2012/09/13 17:15:35 [error] 26027#0: *4923 rewrite or internal
redirection
cycle while processing “/index.php”, client: 201.26.2.XXX, server:
www.XXX.com.br, request: “GET /checkout/cart/ HTTP/1.1”, upstream:
“fastcgi://unix:/var/run/php5-fpm-xxx.sock:”, host: “www.XXX.com.br”,
referrer: “BOOKROSA

The error only after I reload nginx configuration with
“/etc/init.d/nginx
reload”

What can it be?

My host config:

server {
listen xxx.com.br:80 default;

server_name www.xxx.com.br *.xxx.com.br;
root /home/xxx/www/;

location ~ ^/(admin|index.php/admin) {
rewrite / https://$host$request_uri permanent;
break;
}

rewrite ^/minify/([0-9]+)(/..(js|css))$ /lib/minify/m.php?f=$2&d=$1
last;
rewrite ^/skin/m/([0-9]+)(/.
.(js|css))$ /lib/minify/m.php?f=$2&d=$1
last;

location / {
index index.php index.html;
try_files $uri $uri/ @handler;
expires 30d;
}

location ^~ /app/ { deny all; }
location ^~ /includes/ { deny all; }
location ^~ /lib/ { deny all; }
location /lib/minify/ { allow all;}
location ^~ /media/downloadable/ { deny all; }
location ^~ /pkginfo/ { deny all; }
location ^~ /report/config.xml { deny all; }
location ^~ /var/ { deny all; }

location ~/(cron.sh|cron.php|mage)$ { deny all; }
location ^~ /app { deny all; }
location ^~ /includes { deny all; }
location ^~ /lib { deny all; }

location ^~ /downloader { deny all; }
location ^~ /errors/..(xml|phtml)$ { deny all; }
location ^~ /media/customer { deny all; }
location ^~ /media/downloadable { deny all; }
location ^~ /pkginfo { deny all; }
location ^~ /shell { deny all; }
location ^~ /report/.
.(xml|phtml)$ { deny all; }
location ^~ /var { deny all; }

location /. { ## Disable .htaccess and other hidden files
return 404;
}

location @handler { ## Magento uses a common front handler
rewrite / /index.php;
}

location ~ .php/ { ## Forward paths like /js/index.php/x.js to
relevant
handler
rewrite ^(.*.php)/ $1 last;
}

location ~ .php$ { ## Execute PHP scripts
if (!-e $request_filename) { rewrite / /index.php last; } ## Catch
404s
that try_files miss

include /etc/nginx/naxsi.rules;

expires        off; ## Do not cache dynamic content
fastcgi_pass   unix:/var/run/php5-fpm-xxx.sock;
include        fastcgi_params; ## See /etc/nginx/fastcgi_params
fastcgi_param  HTTPS  $http_https;
#fastcgi_param  HTTPS  off;
fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
fastcgi_param  MAGE_RUN_TYPE  store;
fastcgi_param  MAGE_RUN_CODE $magesite_xxx;
break;

}
}

Posted at Nginx Forum:

Hello!

On Fri, Sep 14, 2012 at 02:47:09PM -0400, thiagotognoli wrote:

The error only after I reload nginx configuration with “/etc/init.d/nginx
reload”

What can it be?

My best guest is that somebody removes /index.php (to replace it
with a new one?) + open_file_cache (configured at global level?) +
the fact that there is infinite loop in your config if there is no
/index.php.

[…]

Maxim D.

Thanks for the reply, but do not know if this is the problem because the
open_file_cache is not configured at global level, and index.php is not
changed or replaced, this file was never changed because it is the
default
magento, have any other ideas of what might be?

I appreciate the help …

Posted at Nginx Forum:

Hello!

On Wed, Sep 19, 2012 at 07:55:38PM -0400, thiagotognoli wrote:

Thanks for the reply, but do not know if this is the problem because the
open_file_cache is not configured at global level, and index.php is not
changed or replaced, this file was never changed because it is the default
magento, have any other ideas of what might be?

May be a result of X-Accel-Redirect loop if your backend use it, or
backend error + fastcgi_intercept_errors + error_page loop (again
if configured).

If in doubt, you may activate debug log (see
A debugging log). From debug log it
would be clear what exactly goes on.

Maxim D.