X-Accel-Redirect doen't work with php pages
Kiril Angov
kupokomapa at gmail.com
Thu May 28 00:12:38 MSD 2009
cat test.php?
On Wed, May 27, 2009 at 6:28 PM, Daniele Melosi <ml at melosi.it> wrote:
> Hi all,
>
> i tried using X-Accel-Redirect as described on this guide:
> http://blog.kovyrin.net/2006/11/01/nginx-x-accel-redirect-php-rails/
>
> If i use this conf:
> daniele at lara:/var/www$ cat down.php
> <?
> // And redirect user to internal location
> header("X-Accel-Redirect: /test.html");
> ?>
>
> everything works fine but if i tried to call a php pages:
> daniele at lara:/var/www$ cat down.php
> <?
> // And redirect user to internal location
> header("X-Accel-Redirect: /test.php");
> ?>
>
> with this error:
> [error] 18345#0: *30 rewrite or internal redirection cycle while internal
> redirect to "/test.php" while reading response header from upstream, client:
> 192.168.251.27, server: localhost, request: "GET /down.php HTTP/1.1",
> upstream: "http://127.0.0.1:880/down.php"
>
> this is my configuration:
> server {
> listen 80;
> server_name localhost;
>
> location / {
> root /var/www/nginx-default;
> index index.html index.htm;
> }
>
> location ~* .php$ {
> proxy_pass http://127.0.0.1:880;
> proxy_redirect off;
>
> proxy_set_header Host $host;
> proxy_set_header X-Real-IP $remote_addr;
> proxy_set_header X-Forwarded-For
> $proxy_add_x_forwarded_for;
>
> client_max_body_size 10m;
> client_body_buffer_size 128k;
>
> proxy_connect_timeout 90;
> proxy_send_timeout 90;
> proxy_read_timeout 90;
>
> proxy_buffer_size 4k;
> proxy_buffers 4 32k;
> proxy_busy_buffers_size 64k;
> proxy_temp_file_write_size 64k;
> }
> }
>
> Daniele
>
>
More information about the nginx
mailing list