php - AWS Elastic Beanstalk Laravel 禁止获取文件
问题描述
我在 aws elastic beanstalk 中部署 laravel,我已经成功设置了数据库和项目,并避免使用 storage:link 和我使用路由获取文件的那种(图像,即)。像这样:
Route::get('storage/{folder}/{filename}', function ($folder,$filename)
{
// Add folder path here instead of storing in the database.
$path = storage_path('app/public/'.$folder.'/' . $filename);
if (!File::exists($path)) {
abort(404);
}
$file = File::get($path);
$type = File::mimeType($path);
$response = Response::make($file, 200);
$response->header("Content-Type", $type);
return $response;
});
所以...我有 2 个不同的项目,在 laravel 中具有相同的基本配置(app.php、database.php、.env 等),在 aws 中有相同的环境和应用程序配置,但在一个我获得图像访问和在另一个我得到
Forbidden
You don't have permission to access /storage/productos/pruebalibro.pdf on this server.
一些虽然?我可以检查或做什么?我知道 aws 在 ec2 和其他东西中创建东西,但我应该研究什么?
解决方案
推荐阅读
- audio-streaming - navigator.mediaDevices.enumerateDevices() 没有获得多个音频输出
- jquery - 日期格式化 Moment.js 并显示 Json 文件中的特定数据
- java - call.enqueue(新回调
() 在 Retrofit2 客户端中不起作用 - javascript - 在另一个功能组件中声明 React.memo 是否提供了预期的记忆性能?
- java - Mockito 3.6:在 @Before 或 @BeforeClass 中使用 mockStatic 和 JUnit4
- python - __str__ 在下面的代码中做了什么?列出的两个代码是不同的
- android - FCM 推送通知在设备休眠时重新唤醒应用程序无效
- laravel - Laravel中的动态轮播不显示正确的数据
- python-3.x - 读取文本文件的每一行,删除特定字符串之前的所有字符,然后在 Python 中另存为新文件
- angular - 如何为类属性赋值?