Add location block for `/files/` X-Accel-Redirect rewrites.

Currently WordPress.orgWordPress.org The community site where WordPress code is created and shared by the users. This is where you can download the source code for WordPress core, plugins and themes as well as the central location for community conversations and organization. https://wordpress.org/ uses ms-files.php still, and while it’d be nice to move away from that, it’s not straight forward to doing so.
ms-files.php suffers from a long-term bug where videos can’t be played in Safari due to not supporting Range headers. As a work-around for that, we’d like to enable the X-Accel-Redirect offload functionality which will fix that.

How to test:
– https://make.wordpress.org/core/2020/08/06/wordpress-5-5-core-editor-accessibility-improvements/ has videos that should load/play in Safari, they currently do not.
– Add blogs.dir location blockBlock Block is the abstract term used to describe units of markup that, composed together, form the content or layout of a webpage using the WordPress editor. The idea combines concepts of what in the past may have achieved with shortcodes, custom HTML, and embed discovery into a single consistent API and user experience. (see below)
– Add define( 'WPMU_ACCEL_REDIRECT', true ); to wp-config.php
– Videos should now play in Safari.

Using that as an example, the ms-files path is:
https://make.wordpress.org/core/files/2020/08/roving-tabindex-1.mp4

WPMU_ACCEL_REDIRECT once enabled, outputs:
X-Accel-Redirect: /blogs.dir/6/files/2020/08/roving-tabindex-1.mp4

I believe something similar to the following should work for all WordPress.org network sites (those served out of the WordPress.org users public_html):

location /blogs.dir/ {
  internal;
  alias /uploads/;
}
  • PHPPHP PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML. https://www.php.net/manual/en/preface.php. execution within that location is not required.
  • 404’s should 404, ms-files.php will take care of that.
  • This should NOT apply to buddypress or sites hosted on non-wordpress.org users.
  • The X-Accel-Redirect response can be cached if wanted, but I assume the default caching strategy would already do so.

#prio1