Home  >  Article  >  Backend Development  >  Solve nginx error message: rewrite or internal redirection cycle while internally redirecting to "/",

Solve nginx error message: rewrite or internal redirection cycle while internally redirecting to "/",

WBOY
WBOYOriginal
2016-08-08 09:31:0529905browse

Configure nginx+php-fpm, visit the homepage, and an error message appears:

2015/01/14 23:04:39 [error] 10964#2788: *2 rewrite or internal redirection cycle while internally redirecting to "/", client : 127.0.0.1, server: bk, request: "GET / HTTP/1.1", host: "bk"

Error reason: caused by index command, the solution is to change try_files $uri $uri/; to try_files $uri $uri / =404;

Special note: There cannot be any space between the equal sign of =404 and 404.

Complete configuration: bk.conf source code is as follows (if you need to reprint, please mark the original author default.fu@foxmail.com):

server {
	listen       80;
	server_name  bk;
	root d:/website/bk.com/www;
	index index.html index.htm index.php;
	
	location / {				
		try_files $uri $uri/ =404;
	}
	
	location ~ \.php$ {
		fastcgi_pass   127.0.0.1:9000;
		fastcgi_index  index.php;
		fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
		include        fastcgi_params;    
		try_files $uri =404;
	}
	

	#error_page  404              /404.html;

	# redirect server error pages to the static page /50x.html
	#
	
	error_page   500 502 503 504  /50x.html;
	#location = /50x.html {
	#	root   html;
	#}
	
	location ~ /\.(ht|svn|git) {
		deny all;
	}
}

The above has introduced how to solve the nginx error message: rewrite or internal redirection cycle while internally redirecting to "/", including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn