X-Accel-Redirect issues - Image of 0 size
habodal
nginx-forum at nginx.us
Wed Aug 25 10:35:22 MSD 2010
Hello,
I am trying to use the X-Accel-Redirect header feature of Dokuwiki.
However, when attempting to access images, for example, I receive an
image of zero size which the browsers displays as a URL. I believe my
nginx configuration is to blame.
Nginx config:
server {
listen 80;
server_name dev;
root /var/www/public_html/dev/public;
index index.php;
autoindex on;
location ~ \.php$ {
include /usr/local/etc/nginx/fastcgi.conf;
fastcgi_pass unix:/tmp/php-fpm.sock;
fastcgi_index index.php;
fastcgi_ignore_headers X-Accel-Redirect;
fastcgi_pass_header X-Accel-Redirect;
}
location ^~ /doku/data {
internal;
alias /wiki/data;
}
}
When I attempt to access
http://dev/doku/lib/exe/fetch.php?cache=&media=image.jpg (on filesystems
as /var/www/public_html/dev/public/doku/data/media/image.jpg) the
browser displays the following text with an image mimetype:
http://dev/doku/lib/exe/fetch.php?cache=&media=image.jpg
The headers received are:
Server: nginx
Date: Wed, 25 Aug 2010 06:06:42 GMT
Content-Type: image/jpeg
Expires: Thu, 26 Aug 2010 06:06:42 GMT
Cache-Control: public, proxy-revalidate, no-transform, max-age=86400
Pragma: public
Last-Modified: Mon, 23 Aug 2010 17:01:22 GMT
Content-Disposition: inline; filename="image.jpg";
X-Accel-Redirect:
/var/www/public_html/dev/public/doku/data/media/image.jpg
200 OK
In the access log the request is shown as:
"GET /doku/lib/exe/fetch.php?cache=&media=image.jpg HTTP/1.1" 499 0
"http://dev/doku/lib/exe/detail.php?id=start&media=image.jpg"
"GET /doku/lib/exe/fetch.php?cache=&media=image.jpg HTTP/1.1" 200 5
"http://dev/doku/lib/exe/detail.php?id=start&media=image.jpg"
I see the X-Accel-Redirect and correct mimetype headers are sent. Along
with the image not displaying, shouldn't X-Accel-Redirect header read:
X-Accel-Redirect: /wiki/data/media/image.jpg
due to the alias directive?
What am I doing wrong?
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,123375,123375#msg-123375
More information about the nginx
mailing list