Trying to get nginx to work with the X-Accel-Redirect header. I'm getting this error:
*24 rewrite or internal redirection cycle while internally redirecting to "/app/index.php", client: 127.0.0.1, server: project.dev, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "project.dev" nginx site conf:
server { listen 80; server_name project.dev; root /www/project; location ^~ /f/ { internal; alias /www/project/files/; } location / { try_files $uri /app/index.php$is_args$args; } include php.conf; include apache.conf; } /www/project/app/index.php
<?php header('X-Accel-Redirect: /f/image.jpg'); exit; I added ^~ to the location block, because I thought that would terminate the matching of location blocks, and therefor solve this. This might be a misunderstanding from my part.
Any idea how to fix this?
Update with php.conf and apache.conf
php.conf:
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # 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; } apache.conf:
# deny access to .htaccess files, if Apache's document root # concurs with nginx's one # location ~ /\.ht { deny all; }
php.confandapache.confsince they may be interfering.X-Accel-Redirectand just echo something? What URL are you accessing in the browser? What happens if you specifically access/app/index.php?/www/project/files/image.jpgis served?