解决nginx 报错提示:rewrite or internal redirection cycle while internally redirecting to "/",

配置好nginx+php-fpm,访问首页,提示报错:

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"


报错原因:index 指令导致,解决方法 把 try_files $uri $uri/ ;改成 try_files $uri $uri/ =404;

特别注意:=404的等于号和404之间不能有任何空格。

完整配置:bk.conf源码如下(如需转载,请标注原作者 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;
	}
}


  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
rewrite or internal redirection cycle while internally redirecting to "/index.html" 是一个nginx的错误,它表示在内部重定向过程中出现了循环。 这个错误通常是由于nginx配置文件中的重写规则设置错误导致的。根据提供的配置文件段落,可以看出在location /的配置中使用了try_files指令来匹配请求的文件,如果找不到则会重定向到/oeos/index.html。但是,在/oeos/index.html页面中可能又存在重定向规则,导致了循环重定向的情况。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [[nginx]nginx rewrite or internal redirection cycle while internally redirecting](https://blog.csdn.net/qubes/article/details/125655094)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *3* [解决nginx 报错提示rewrite or internal redirection cycle while internally redirecting to “/](https://blog.csdn.net/qq_32406257/article/details/121658449)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值