NGINX redirection issue

Maxim Dounin mdounin at mdounin.ru
Sun Aug 31 02:45:41 UTC 2014


Hello!

On Fri, Aug 29, 2014 at 10:08:57AM -0400, manish-ezest wrote:

> Hello Maxim,
> 
> I tried enabling debug mode but still I am not able to figure out the issue
> and its possible solutions. 
> 
> I disabled this rewrites which are rewriting to index.html
> ## Rewrite all directory lookups to 'index.html'
> #rewrite ^(.*)/$ $1/index.html permanent;
> 
> ## Rewrite all open strings to index.html
> #rewrite ^(.*)/([^\.\?/]+)$  $1/$2/index.html permanent;
> 
> and added this one as you suggested but now it is going to
> www.google.com(very strange)
> 
> location / {
>         index index.html;
>         try_files $uri.html $uri/ =404;
> 		}
> 
> Error Log Content
> 
> 2014/08/29 09:40:28 [error] 935#0: *64 upstream timed out (110: Connection
> timed out) while reading response header from upstream, client: 11.11.11.11,
> server: www.aaa.com, request: "GET /favicon.ico HTTP/1.1", upstream:
> "fastcgi://127.0.0.1:8999", host: "www.aaa.com"
> 2014/08/29 09:40:38 [error] 935#0: *64 upstream timed out (110: Connection
> timed out) while reading response header from upstream, client: 11.11.11.11,
> server: www.aaa.com, request: "GET /favicon.ico HTTP/1.1", upstream:
> "fastcgi://127.0.0.1:8999", host: "www.aaa.com"
> 2014/08/29 09:40:48 [error] 935#0: *64 upstream timed out (110: Connection
> timed out) while reading response header from upstream, client: 11.11.11.11,
> server: www.aaa.com, request: "GET /favicon.ico HTTP/1.1", upstream:
> "fastcgi://127.0.0.1:8999", host: "www.aaa.com"
> 2014/08/29 09:40:58 [error] 935#0: *64 upstream timed out (110: Connection
> timed out) while reading response header from upstream, client: 11.11.11.11,
> server: www.aaa.com, request: "GET /favicon.ico HTTP/1.1", upstream:
> "fastcgi://127.0.0.1:8999", host: "www.aaa.com"
> 2014/08/29 09:41:08 [error] 935#0: *64 upstream timed out (110: Connection
> timed out) while reading response header from upstream, client: 11.11.11.11,
> server: www.aaa.com, request: "GET /favicon.ico HTTP/1.1", upstream:
> "fastcgi://127.0.0.1:8999", host: "www.aaa.com"

[...]

>From the logs it looks like the loop is caused by error_page you 
use, and recursive_error_pages set somewhere in your 
configuration.  As long as your error handler script times out 
(likely because it can't cope with load), nginx tries to call it 
again, then again, then again.  This continues till nginx reaches 
the redirections limit and logs the message about it.

Find where recursive_error_pages is set and switch it off - or, 
rather, just remove it from the configuration.  As previously 
said, the default is correct and should not be changed unless you 
understand what you are doing.  This should resolve your problem.

-- 
Maxim Dounin
http://nginx.org/



More information about the nginx mailing list