Php X-Accel-redirect的内部重定向别名错误

Php X-Accel-redirect的内部重定向别名错误,php,nginx,x-sendfile,x-accel-redirect,Php,Nginx,X Sendfile,X Accel Redirect,Nginx内部重定向文件搜索路径错误 我正在使用nginx和laravel(PHP)并希望进行安全的在线存储。如果用户存在并拥有权限,用户可以下载文件。我正在使用“X-Accel-Redirect”执行此操作 //它与apache X-Sendfile一起工作 公共功能下载() { $filename=“4.jpg”; 返回响应(null) ->标题('Content-Disposition','attachment;filename=“.$filename.”) ->标题('X-Accel-R

Nginx内部重定向文件搜索路径错误

我正在使用nginx和laravel(PHP)并希望进行安全的在线存储。如果用户存在并拥有权限,用户可以下载文件。我正在使用“X-Accel-Redirect”执行此操作

//它与apache X-Sendfile一起工作
公共功能下载()
{
$filename=“4.jpg”;
返回响应(null)
->标题('Content-Disposition','attachment;filename=“.$filename.”)
->标题('X-Accel-Redirect',“/storage/app/public/$filename”)
->标题('X-Sendfile',基本路径(“存储/app/public/$filename”);
}
nginx形态

    root /var/www/public;
#...
    location /storage/ {
      alias /var/www/storage/;
      internal;
    }
#also i tried root key same result not changed
我认为alias没有覆盖到父作用域根键,但我必须解决这个问题

Nginx Log ---
[error] 35#35: *1 open() "/var/www/public/storage/app/public/4.jpg" failed (2: No such file or directory),

存储在/var/www/storage/app/public/4.jpg中的普通文件

我用nginx conf修复了它。nginx没有捕捉到url,所以我用这些配置进行了更改

 location ^~ /storage/ {
      alias /var/www/storage/;
      internal;
    }

我用nginx conf修复了它。nginx没有捕捉到url,所以我用这些配置进行了更改

 location ^~ /storage/ {
      alias /var/www/storage/;
      internal;
    }