I have the following block in my nginx config:
location /files {
internal;
root /var/www/website/storage/uploads;
}
In my Laravel app I am trying to redirect get-file
URI to the private internal /files
route (The get-file
URI triggers the following PHP method get_file
):
public function get_file(Request $request)
{
$path_to_file = "/files/image.jpg"
return response('')->header('X-Accel-Redirect', $path_to_file);
}
But I get 404 Not Found
from nginx (with the nginx error page).
And the file image.jpg
exists in /var/www/website/storage/uploads/