我已经创建了一个默认的CakePHP 2.4项目,并创建了Nginx配置如下,但我从Nginx错误日志中得到这些错误。我做错了什么?
我环境:- Debian(老生常谈的)
- nginx/1.2.1 " 项目目录/var/www/backhaus
错误是:
$ 2014/06/14 09:39:22 [error] 5952#0: *1在处理"/backhaus"时重写或内部重定向周期,client: xxx x.x.x。xx,服务器:azazel,请求:"GET/backhaus HTTP/1.1",主机:"azazel"
这是我的配置从../sites-available/default
:
location /backhaus {
root /var/www/backhaus/app/webroot/;
index index.php;
rewrite ^/* /backhaus;
location ~ ^/(.+'.php)$ {
try_files $uri $uri/ =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
您的错误如下:
$ 2014/06/14 09:39:22 [error] 5952#0: *1重写或内部处理"/backhaus"时重定向周期,客户端:x.x.x.xx,服务器:azazel,请求:"GET/backhaus HTTP/1.1",主机:"azazel"
并且错误清楚地表明:
…重定向循环处理"/backhaus"…
现在,让我们看看你发布的Nginx配置:
location /backhaus {
root /var/www/backhaus/app/webroot/;
index index.php;
rewrite ^/* /backhaus;
location ~ ^/(.+'.php)$ {
try_files $uri $uri/ =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
问题似乎是你的location
是/backhaus
,但然后你通过这条线将任何流量重定向到/backhaus
到/backhaus
:
rewrite ^/* /backhaus;
所以我建议删除rewrite
行