Welcome! Log In Create A New Profile

Advanced

rewrite or internal redirection cycle while internally redirecting to "/index.php"

December 27, 2012 06:34AM
Hello everyone,
I'm having some issue with X-accel and I'd be happy if someone could look over my configuration file and let me know what I did wrong.
I am basically running nginx/1.2.5 with php-fpm 5.3.3 on Centos 5.5

I am running an application that is served using Zend Framework from /var/www/domain/html/http
I have many files available for download from /var/www/domain/html/files/projects/$id/$file_name ($id is anything ranging from 1-999 and $file_name is a zip file).

I want to basically serve the zip files using X-Accel and bypass php-fpm.

In the application when I check if the file can be served or not - I added this: header("X-Accel-Redirect: " . $file); in order to serve it using X-Accel.

I also added this location in my config to serve the zip files using nginx
location /projects {
internal;
root /var/www/domain/html/files;
}

The problem is I get a 500 error and when I look at the log file - this is what I can spot:

[error] 10274#0: *25 rewrite or internal redirection cycle while internally redirecting to "/index.php"



This is the content of my domain.conf in /conf.d


server {
listen 80;
listen 443 ssl;
server_name domain.com;
ssl_certificate /etc/nginx/certs/www.domain.com.crt;
ssl_certificate_key /etc/nginx/certs/www.domain.com.key;
return 301 $scheme://www.domain.com$request_uri;
}
server {
listen 80;
listen 443 ssl;
server_name www.domain.com;
error_log /var/www/domain/logs/error_log warn;
ssl_certificate /etc/nginx/certs/www.domain.com.crt;
ssl_certificate_key /etc/nginx/certs/www.domain.com.key;
root /var/www/domain/html/http;
index index.php;
client_max_body_size 250m;
error_page 403 404 =404 /notfound;
include /etc/nginx/conf.d/domain.locations;
}


#### Content of domain.locations

if ( $request_uri ~ "^/index.php" ) {
rewrite ^/index.php(.*) $1 permanent;
}
location / {
rewrite ^/wanted/feed$ /feed?filter=wanted permanent;
try_files $uri $uri/ /index.php?$args;
}
location /min {
try_files $uri $uri/ /min/index.php?q=;
}
location /blog {
try_files $uri $uri/ /blog/index.php?q=$1;
}
location /apc {
try_files $uri $uri/ /apc.php$args;
}
location /projects {
internal;
root /var/www/domain/html/files;
}
location ~ \.php {
include /etc/nginx/fastcgi_params;
fastcgi_param HTTPS $https if_not_empty;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param SERVER_NAME $http_host;
fastcgi_pass 127.0.0.1:9000;
}
location ~* ^.+\.(ht|svn|git)$ {
deny all;
}

# Static files location
location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$ {
expires max;
}
SubjectAuthorPosted

rewrite or internal redirection cycle while internally redirecting to "/index.php"

adambenayounDecember 27, 2012 06:34AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 63
Record Number of Users: 7 on March 06, 2014
Record Number of Guests: 229 on August 01, 2014
Powered by nginx    Powered by FreeBSD    PHP Powered    Powered by Percona     ipv6 ready