I am trying to get “X-Accel-Redirect” working on my ngnix and Wordpress
MU server.
I came across this official wordpress thread -
http://trac.mu.wordpress.org/changeset/1946
I followed it. I added codes in blogs.php. I also defined
‘WPMU_ACCEL_REDIRECT’ as ‘true’.
After that I ended in 500 errors. 
Then I found this article written in chinese - http://bit.ly/74uWtM
(english translation - http://bit.ly/89ei5Z)
I also found reason of 500 error to be “redirect loop”.
I followed that chinese bloggers advise and code but ended up in 404
errors.
I think I need to have something correct in ngnix conf files but I
failed to figure it out.
I could not come out of series of 404 and 500 errors.
Can anyone got “X-Accel-Redirect” working with Wordpress MU
successfully?
Posted at Nginx Forum:
Jeff W. Wrote:
G’day, from the author of that patch. 
Glad to meet you. I just cannot thank you enough for making that great
patch.
It saved me and my blog network! 
Here’s the relevant configuration snippet I use:
location ^~ /blogs.dir {
internal;
alias
/srv/example.com/root/wp-content/blogs.dir;
}
I did it and it worked like a charm!
I have one question though. I see your patch had ‘exit’ before sending
following headers.
@header( “Last-Modified: $last_modified GMT” );
@header( 'ETag: ’ . $etag );
@header( ‘Expires: ’ . gmdate(‘D, d M Y H:i:s’, time() + 100000000) . ’
GMT’ );
I modified code to send above headers, but it didn’t worked well.
I guess above headers if successfully sent will further enhance
performance.
If “client has file cached” server can return “304 not modified” and a
lot of data transfer can be saved!
What do you think? Any way to add atleast “Etag” header?
Posted at Nginx Forum:
you can configure the expires via
Module ngx_http_headers_module
I did it and it worked.
But then I moved following 3 lines above “X-Accel-Redirect” code block
in wordpress’ blogs.php
@header( “Last-Modified: $last_modified GMT” );
@header( 'ETag: ’ . $etag );
@header( ‘Expires: ’ . gmdate(‘D, d M Y H:i:s’, time() + 100000000) . ’
GMT’ );
and it worked too. I received following response.
HTTP/1.1 200 OK
Server: nginx/0.7.62
Date: Sat, 28 Nov 2009 08:00:11 GMT
Content-Type: image/jpeg
Content-Length: 27429
Last-Modified: Sun, 22 Nov 2009 20:58:54 GMT
Connection: keep-alive
Expires: Mon, 28 Jan 2013 17:46:51 GMT
Accept-Ranges: bytes
(Note: “Last Modified” line was present before above change)
I also found this particular thread very useful -
http://marc.info/?l=nginx&m=120127279110733&w=2
and based on that only change nginx needs in its core is to add “Etag”
header in ignore-list of “X-Accel-Redirect” code.
I may be wrong as this is my 6th day (only) on nginx and I never gone
this far with my X (Apache) 
Posted at Nginx Forum:
On Fri, Nov 27, 2009 at 03:26:00AM -0500, rahul286 wrote:
I also found reason of 500 error to be “redirect loop”.
I followed that chinese bloggers advise and code but ended up in 404 errors.
I think I need to have something correct in ngnix conf files but I failed to figure it out.
I could not come out of series of 404 and 500 errors.
Can anyone got “X-Accel-Redirect” working with Wordpress MU successfully?
In this configuration:
location /uri1/ {
fastcgi_pass wordpress;
}
location /uri2/ {
internal;
root /path/to/files;
}
a public URL is /uri1/some_file, WordPress should return
“X-Accel-Redirect: /uri2/some_file”,
then nginx will send “/path/to/files/uri2/some_file”.
–
Igor S.
http://sysoev.ru/en/
I am trying to get “X-Accel-Redirect” working on my ngnix and Wordpress MU
server.
I came across this official wordpress thread -
http://trac.mu.wordpress.org/changeset/1946
I followed it. I added codes in blogs.php. I also defined
‘WPMU_ACCEL_REDIRECT’ as ‘true’.
G’day, from the author of that patch. 
Here’s the relevant configuration snippet I use:
location ^~ /blogs.dir {
internal;
alias /srv/example.com/root/wp-content/blogs.dir;
}
That’s all you have to do → an internal /blogs.dir location, aliased to
the
real blogs.dir directory.
Enjoy!
–
Robot Parade
http://www.robotparade.com.au/
m. +61 423 989 818 b. http://bethesignal.org/ p. +61 2 9043
2940
@Jeff
I moved ur patched codes (for blog.php) file towards the end - just
before readfile() function and it worked much better.
Earlier files were being served through nginx server every time since we
were making exit before “Conditional GET” codes.
Now with this change I am able to get “304 Not Modified” as per my
expectation (example you can see below)
HTTP/1.1 304 Not Modified
Server: nginx/0.7.62
Date: Sat, 28 Nov 2009 08:12:07 GMT
Connection: keep-alive
X-Powered-By: PHP/5.2.10-2ubuntu6
Content-Length: 27429
Last-Modified: Sun, 22 Nov 2009 20:58:54 GMT
Expires: Mon, 28 Jan 2013 17:58:47 GMT
Posted at Nginx Forum:
On Nov 27, 2009, at 12:05 PM, rahul286 wrote:
I guess above headers if successfully sent will further enhance performance.
If “client has file cached” server can return “304 not modified” and a lot of data transfer can be saved!
What do you think? Any way to add atleast “Etag” header?
I think this should be handled by nginx and not your php scripts. Since
nginx will be handling the files directly from the filesystem it should
send out the Expires and Etag headers.
you can configure the expires via
http://wiki.nginx.org/NginxHttpHeadersModule#expires
Rob