【问题标题】:Trying to upload image on Laravel Ubuntu Nginx Server尝试在 Laravel Ubuntu Nginx 服务器上上传图像
【发布时间】:2020-06-15 07:34:32
【问题描述】:

我刚刚在 Nginx Ubuntu Server 上部署了我的 laravel 项目,但每当我尝试上传图片时,我都会收到此错误

2020-06-14 21:00:32] production.ERROR: fopen(/var/www/laravel/public/image/uploads/1.png): failed to open stream: Permission denied {"userId":1,"exception":"[object] (ErrorException(code: 0): fopen(/var/www/laravel/public/image/uploads/1.png): failed to open stream: Permission denied at /var/www/laravel/vendor/league/flysystem/src/Adapter/Local.php:157)

在我的数据库中我也得到了这个/tmp/phpuFp8xC

我做错了什么?

【问题讨论】:

  • 如果你可以访问命令行,给public 777 权限级别使用这个命令chmod -R 777 public 确保你在 Laravel 项目根文件夹中
  • 现在出现这个错误2020-06-14 21:13:07] production.ERROR: URI must be a string or UriInterface (View: /var/www/laravel/resources/views/pages/welcome.blade.php) {"exception":"[object] (ErrorException(code: 0): URI must be a string or UriInterface (View: /var/www/laravel/resources/views/pages/welcome.blade.php) at /var/www/laravel/vendor/guzzlehttp/psr7/src/functions.php:62)

标签: php laravel ubuntu nginx


【解决方案1】:

你可以在 config/filesystems.php 中试试这个

'disks' => [

'local' => [
    'driver' => 'local',
    'root'   => public_path(), // previously storage_path();
],]

【讨论】:

  • 我现在收到此错误2020-06-14 21:13:07] production.ERROR: URI must be a string or UriInterface (View: /var/www/laravel/resources/views/pages/welcome.blade.php) {"exception":"[object] (ErrorException(code: 0): URI must be a string or UriInterface (View: /var/www/laravel/resources/views/pages/welcome.blade.php) at /var/www/laravel/vendor/guzzlehttp/psr7/src/functions.php:62)
猜你喜欢
  • 2021-05-08
  • 2021-04-05
  • 2018-12-07
  • 2021-09-06
  • 1970-01-01
  • 2018-08-15
  • 2019-05-06
  • 2018-01-17
  • 2019-07-31
相关资源
最近更新 更多